Sample Source Code For Database Load

Contents
idms
Contents
This section presents sample source code for:
  • A DL/I PSB and its associated DBDs
  • An IPSB load module
  • A CA IDMS/DB schema module
The samples illustrate the process of preparing the necessary modules for use with the CA IDMS DLI Transparency load utility.
The IPSB source code and the CA IDMS/DB source code both derive from the DL/I PSB and DBDs.
The source code examples are also reflected in the sample reports that appear for the various steps in the database load process (described later in the section).
Sample DL/I PSB and DBDs
Figure 58 shows the source for two logically related DL/I databases and a PSB. The DBD descriptions define:
  • Two HIDAM physical databases (ITEMDBDP and PARTDBDP)
  • Two logical databases (ITEMDBDL and PARTDBDL)
  • Two index databases (ITEMDBDI and PARTDBDI)
The PSB references the two logical databases.
The physical databases have root segments named ITEM and PART, respectively. They are logically related using the DETAIL segment.
Source statements for DL/I PSB and DBDs:
 DL/I ITEM DATABASE PHYSICAL DBD EXAMPLE          DBD      NAME=ITEMDBDP,ACCESS=HIDAM          DATASET  DD1=ITEMDB,DEVICE=FBA          SEGM     NAME=ITEM,PARENT=0,BYTES=150,POINTER=TB,RULES=PPV          LCHILD   NAME=(ITEMNDX,ITEMDBDI),POINTER=INDX          FIELD    NAME=(ITEMNO,SEQ),BYTES=7,START=1          SEGM     NAME=DETAIL,PARENT=((ITEM,SNGL),                     X                (PART,VIRTUAL,PARTDBDP)),BYTES=150,                     X                RULES=PVV,POINTER=(TB,LTB)          FIELD    NAME=(ITMDTAIL,SEQ),BYTES=3,START=19          DBDGEN          FINISH          END  DL/I PARTS DATABASE PHYSICAL DBD EXAMPLE          DBD      NAME=PARTDBDP,ACCESS=HIDAM          DATASET  DD1=PARTDB,DEVICE=FBA          SEGM     NAME=PART,PARENT=0,BYTES=150,POINTER=TB,RULES=PPV          LCHILD   NAME=(PARTNDX,PARTDBDI),POINTER=INDX          LCHILD   NAME=(DETAIL,ITEMDBDP),POINTER=SNGL,PAIR=DETAILV          FIELD    NAME=(PARTNO,SEQ),BYTES=18,START=1          SEGM     NAME=DETAILV,PARENT=PART,POINTER=PAIRED,             X                SOURCE=((DETAIL,,ITEMDBDP))          FIELD    NAME=(ITMDTAIL,SEQ,M),BYTES=3,START=8          DBDGEN          FINISH          END  DL/I ITEM INDEX DBD EXAMPLE          DBD      NAME=ITEMDBDI,ACCESS=INDEX          DATASET  DD1=ITEMIX,DEVICE=FBA          SEGM     NAME=ITEMNDX,PARENT=0,BYTES=7          LCHILD   NAME=(ITEM,ITEMDBDP),POINTER=SNGL,INDEX=(ITEMNO)          FIELD    NAME=(ITEMNO,SEQ,U),BYTES=7,START=1          DBDGEN          FINISH          END Figure 58 (Part 1 of 2). Source statements for DL/I PSB and DBDs  DL/I PARTS INDEX DBD EXAMPLE          DBD      NAME=PARTDBDI,ACCESS=INDEX          DATASET  DD1=PARTIX,DEVICE=FBA          SEGM     NAME=PARTNDX,PARENT=0,BYTES=18          LCHILD   NAME=(PART,PARTDBDP),POINTER=SNGL,INDEX=(PARTNO)          FIELD    NAME=(PARTNO,SEQ,U),BYTES=18,START=1          DBDGEN          FINISH          END  DL/I ITEM DATABASE LOGICAL DBD EXAMPLE          DBD      NAME=ITEMDBDL,ACCESS=LOGICAL          DATASET  LOGICAL          SEGM     NAME=ITEM,PARENT=0,SOURCE=((ITEM,,ITEMDBDP))          SEGM     NAME=DETAIL,PARENT=ITEM,                            X                SOURCE=((DETAIL,,ITEMDBDP),(PART,,PARTDBDP))          DBDGEN          FINISH          END  DL/I PARTS DATABASE LOGICAL DBD EXAMPLE          DBD      NAME=PARTDBDL,ACCESS=LOGICAL          DATASET  LOGICAL          SEGM     NAME=PART,PARENT=0,SOURCE=((PART,,PARTDBDP))          SEGM     NAME=DETAIL,PARENT=PART,                            X                SOURCE=((DETAIL,,ITEMDBDP),(ITEM,,ITEMDBDP))          DBDGEN          FINISH          END
Figure 58 (Part 2 of 2). Source statements for DL/I PSB and DBDs
Sample Load IPSB
GENERATE IPSB Statement
Assuming the DL/I PSB and DBD definitions in illustration 6-1 are assembled and are available to the syntax generator using a CDMSLIB JCL statement, the following GENERATE statement will produce the appropriate IPSB source code for use with the load process:
GENERATE LOAD IPSB FOR PSB ITEMPART USING SUBSCHEMA PRODSUBS.
This statement instructs the generator to produce an IPSB named ITEMPART and submit it to validity checking for use with the load process.
Figure 59 shows the IPSB source code as it might be produced by the syntax generator using the DL/I DBD and PSB definitions in Figure 58.
Considerations
Here are some points to note about the IPSB source code:
  • Each PCB in the DL/I PSB appears as a separate entry in the IPSB's PCB section
  • Each PCB entry describes both the physical segments involved and how the physical segments extend into the logical path
  • Once the IPSB source is compiled, the resulting IPSB load module can be used to load both of the logically related databases (ITEMDBDL and PARTDBDL). A PCB for each of these DBDs must be included in the IPSB for a successful load.
GENERATE IPSB Statement LOAD Parameter
The use of the LOAD parameter in the GENERATE statement ensures that the resulting IPSB includes all of the DL/I dependencies necessary for a successful load. If a PCB does not identify the physical segment that corresponds to a referenced logical parent, the syntax generator will return an error message and not create the IPSB source.
An example
For example, if the PARTDBDL PCB were not present in the assembled DL/I ITEMPART PSB, the syntax generator would return an error message stating that it could not find the DBD for the logical parent in any PCB. In this case, the missing DBD would be the physical DBD, as referenced by the logical DBDs, ITEMDBDL and PARTDBDL. Providing the PCB for the logical DBD PARTDBDL would satisfy the load process requirements and produce the correct IPSB source.
Generated IPSB source statements:
 DL/I ITEM DATABASE LOGICAL DBD EXAMPLE  DBD      NAME=ITEMDBDL,ACCESS=LOGICAL  DATASET  LOGICAL  SEGM     NAME=ITEM,PARENT=0,SOURCE=((ITEM,,ITEMDBDP))  SEGM     NAME=DETAIL,PARENT=ITEM,                       SOURCE=((DETAIL,,ITEMDBD),(PART,,PARTDBDP))  DBDGEN  FINISH  END  DL/I PARTS DATABASE LOGICAL DBD EXAMPLE  DBD      NAME=PARTDBDL,ACCESS=LOGICAL  DATASET  LOGICAL  SEGM     NAME=PART,PARENT=0,SOURCE=((PART,,PARTDBDP))  SEGM     NAME=DETAIL,PARENT=PART,                       SOURCE=((DETAIL,,ITEMDBDP),(ITEM,,ITEMDBDP))  DBDGEN  FINISH  END  DL/I PSB DESCRIBING ITEM AND PARTS LOGICAL DBDS  PCB      TYPE=DB,DBDNAME=ITEMDBDL,PROCOPT=AP,KEYLEN=28,POS=S  SENSEG   NAME=ITEM,PARENT=0  SENSEG   NAME=DETAIL,PARENT=ITEM  PCB      TYPE=DB,DBDNAME=PARTDBDL,PROCOPT=AP,                KEYLEN=28,POS=S  SENSEG   NAME=PART,PARENT=0  SENSEG   NAME=DETAIL,PARENT=PART  PSBGEN   LANG=ASM,PSBNAME=ITEMPART  END  IPSB SECTION.           IPSB NAME IS ITEMPART           OF SUBSCHEMA PRODSUBS           LANGUAGE IS ASM.
Figure 59 (Part 1 of 4). Generated IPSB source statements
 AREA SECTION.           AREA NAME IS ITEMDBDP-REGION                USAGE-MODE IS EXCLUSIVE UPDATE.           AREA NAME IS PARTDBDP-REGION                USAGE-MODE IS EXCLUSIVE UPDATE.  RECORD SECTION.           RECORD NAME IS ITEM                LENGTH IS  150.           SEQUENCE           FIELD NAME IS ITEMNO                START POS  1                LENGTH IS  7.           RECORD NAME IS DETAIL                LENGTH IS  157.           SEQUENCE           FIELD NAME IS ITMDTAIL                START POS  26                LENGTH IS  3.           LOGICAL PARENT CONCAT KEY           FIELD NAME IS DETALPCK                START POS  1                LENGTH IS  18.           PHYSICAL PARENT CONCAT KEY           FIELD NAME IS DETAPPCK                 START POS  19                 LENGTH IS  7.           RECORD NAME IS PART                 LENGTH IS  150           SEQUENCE           FIELD NAME IS PARTNO                 START POS  1                 LENGTH IS  18.           RECORD NAME IS ITEMNDX                 LENGTH IS  7.           SEQUENCE           FIELD NAME IS ITEMNO                 START POS  1                 LENGTH IS  7.
Figure 59 (Part 2 of 4). Generated IPSB source statements
          RECORD NAME IS PARTNDX                 LENGTH IS  18.           SEQUENCE           FIELD NAME IS PARTNO                 START POS  1                 LENGTH IS  18.  INDEX SECTION           INDEX NAME IS ITEMDBDT                 USING INDEXED-SET IX-ITEMNDX                 TARGET RECORD IS ITEM                 POINTER RECORD IS ITEMNDX                       THRU SET ITEM-ITEMNDX                 SOURCE RECORD IS ITEM                 SEARCH FIELD (ITEMNO).           INDEX NAME IS PARTDBDI                 USING INDEXED-SET IX-PARTNDX                 TARGET RECORD IS PART                 POINTER RECORD IS PARTNDX                       THRU SET PART-PARTNDX                 SOURCE RECORD IS PART                 SEARCH FIELD (PARTNO).  PCB SECTION.           PCB ACCESS METHOD IS HIDAM                 DBDNAME IS ITEMDBDL                 PROCESSING OPTIONS LOAD                 PROC SEQ INDEX IS ITEMDBDI.           SEGM NAME IS ITEM           RECORD  NAME IS ITEM.           SEGM NAME IS DETAIL           RECORD  NAME IS DETAIL                 PARENT IS ITEM                       THRU SET ITEM-DETAIL                 LOGICAL DEST PARENT IS PART                       THRU SET PART-DETAIL                 INSERT RULES P,P,P                 REPLACE RULES V,V,V                 ACCESS METHOD IS HIDAM                 PROC SEQ INDEX IS PARTDBDI.
Figure 59 (Part 3 of 4). Generated IPSB source statements
          PCB ACCESS METHOD IS HIDAM                 DBDMANE IS PARTDBDL                 PROCESSING OPTIONS LOAD                 PROC SEQ INDEX IS PARTDBDI.           SEGM NAME IS PART           RECORD   NAME IS PART.           SEGM NAME IS DETAIL           RECORD   NAME IS DETAIL                PARENT  IS PART                      THRU SET PART-DETAIL                PHYSICAL DEST PARENT IS ITEM                      THRU SET ITEM-DETAIL                INSERT RULES P,L,P                REPLACE RULES V,L,V                ACCESS METHOD IS HIDAM                PROC SEQ INDEX IS ITEMDBDI                SEQUENCE BY LOGICAL SEQ FIELD.
Figure 59 (Part 4 of 4). Generated IPSB source statements
Sample CA IDMS/DB Schema Module
GENERATE Schema Statement
Just as with the IPSB source code, you can use the syntax generator to make sure that you have a CA IDMS/DB schema module that will support a successful database load. The GENERATE statement in this case takes the following form:
GENERATE LOAD SCHEMA NAME IS LOADSCHM FOR DBD ITEMDBDP, PARTDBDP.
Note that physical DBD names are all that you need to produce the schema source.
Figure 60 shows the schema source code as it might be produced by the syntax generator using the DL/I physical DBD definitions in Figure 58.
Considerations
Here are some general considerations about the schema source code produced by the syntax generator:
  • The generated schema has OPTIONAL MANUAL set connection options for each logical child/logical parent set.
  • Generated schema source by itself is not sufficient for a database load. It must be edited to include site-specific standards, optimized database page ranges, and so on.
  • If you already have a suitable CA IDMS/DB schema, you can modify this schema without having to create a new load schema. Specifically, you must make sure that the logical child/logical parent set description has OPTIONAL MANUAL connection options. These options are required only during the load process and can be changed to MANDATORY AUTOMATIC after the load. The only exception is in the case of bill-of-materials relationships.
  • In this type of relationship the logical parent and physical parent of the child record are different occurrences of the same record type. Bill of materials sets must have OPTIONAL MANUAL connection options.
  • The page ranges specified for the CA IDMS/DB database in the schema/subschema must be consistent throughout the load process. A change in the page ranges will invalidate the database pages calculated by the preload CALC processing (Step 1). In this case, you will have to repeat both the CALC and load steps so the logical workfile produced by the load can give correct results for the prefix update step.
Generated Schema source statements:
 SIGNON           USAGE MODE IS UPDATE .  SET OPTIONS FOR SESSION           INPUT     1 THRU     72.  ADD SCHEMA NAME IS LOADSCHM VERSION     1           MEMO DATE IS 12/22/86           ASSIGN RECORD IDS FROM     101           PUBLIC ACCESS IS ALLOWED FOR ALL.  ADD AREA NAME IS PARTDBDP-REGION.  ADD AREA NAME IS ITEMDBDP-REGION.  ADD RECORD NAME IS PART           RECORD ID IS AUTO           LOCATION MODE IS CALC           USING PARTNO           DUPLICATES ARE NOT ALLOWED           WITHIN AREA PARTDBDP-REGION.  02       PARTNO            PIC X (18).  02       FILLER            PIC X (132).  ADD RECORD NAME IS ITEM           RECORD ID IS AUTO           LOCATION MODE IS CALC           USING ITEMNO           DUPLICATES ARE NOT ALLOWED           WITHIN AREA ITEMDBDP-REGION.  02       ITEMNO            PIC X (7).  02       FILLER            PIC X (143).  ADD RECORD NAME IS DETAIL           RECORD ID IS AUTO           LOCATION MODE IS VIA ITEM-DETAIL           WITHIN AREA ITEMDBDP-REGION.  02       FILLER            PIC X (25).  02       ITMDTAIL          PIC X (3).  02       FILLER            PIC X (129).
Figure 60 (Part 1 of 4). Generated Schema source statements
 ADD RECORD NAME IS PARTNDX           RECORD ID IS AUTO           LOCATION MODE IS VIA PART-PARTNDX           WITHIN AREA PARTDBDP-REGION.  02       PARTNO            PIC X (18).  ADD RECORD NAME IS ITEMNDX           RECORD ID IS AUTO           LOCATION MODE IS VIA ITEM-ITEMNDX           WITHIN AREA ITEMDBDP-REGION.  02       ITEMNO            PIC X (7).  ADD SET NAME IS ITEM-DETAIL           ORDER IS SORTED           MODE IS CHAIN LINKED TO PRIOR           OWNER IS ITEM                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           MEMBER IS DETAIL                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           LINKED TO OWNER                OWNER DBKEY POSITION IS AUTO           MANDATORY AUTOMATIC           ASCENDING KEY IS ITMDTAIL           DUPLICATES ARE NOT ALLOWED.  ADD SET NAME IS PART-DETAIL           ORDER IS SORTED           MODE IS CHAIN LINKED TO PRIOR           OWNER IS PART                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           MEMBER IS DETAIL                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           LINKED TO OWNER                OWNER DBKEY POSITION IS AUTO           OPTIONAL MANUAL           ASCENDING KEY IS ITMDTAIL           DUPLICATES ARE LAST.
Figure 60 (Part 2 of 4). Generated Schema source statements
 ADD SET NAME IS PART-PARTNDX           ORDER IS SORTED           MODE IS CHAIN LINKED TO PRIOR           OWNER IS PART                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           MEMBER IS PARTNDX                NEXT DBKEY POSITION IS AUTO           LINKED TO OWNER                OWNER DBKEY POSITION IS AUTO           MANDATORY AUTOMATIC           ASCENDING KEY IS PARTNO           DUPLICATES ARE NOT ALLOWED.  ADD SET NAME IS ITEM-ITEMNDX           ORDER IS SORTED           MODE IS CHAIN LINKED TO PRIOR           OWNER IS ITEM                NEXT DBKEY POSITION IS AUTO                PRIOR DBKEY POSITION IS AUTO           MEMBER IS ITEMNDX                NEXT DBKEY POSITION IS AUTO           LINKED TO OWNER                OWNER DBKEY POSITION IS AUTO           MANDATORY AUTOMATIC           ASCENDING KEY IS ITEMNO           DUPLICATES ARE NOT ALLOWED.  ADD SET NAME IS IX-PARTNDX           ORDER IS SORTED           MODE IS INDEX                BLOCK CONTAINS  50 KEYS           OWNER IS SYSTEM           MEMBER IS PARTNDX                INDEX DBKEY POSITION IS AUTO           MANDATORY AUTOMATIC           ASCENDING KEY IS PARTNO           DUPLICATES ARE NOT ALLOWED.
Figure 60 (Part 3 of 4). Generated Schema source statements
 ADD SET NAME IS IX-ITEMNDX           ORDER IS SORTED           MODE IS INDEX                BLOCK CONTAINS  50 KEYS           OWNER IS SYSTEM           MEMBER IS ITEMNDX                INDEX DBKEY POSITION IS AUTO           MANDORY AUTOMATIC           ASCENDING KEY IS ITEMNO           DUPLICATES ARE NOT ALLOWED.  VALIDATE.  SIGNOFF.
Figure 60 (Part 4 of 4). Generated Schema source statements