Sample Source Code For Database Load

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:
Figure 58 (Part 2 of 2). Source statements for DL/I PSB and DBDs
Sample Load IPSB
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:
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.
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:
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:
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.
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:
Figure 60 (Part 1 of 4). Generated Schema source statements
Figure 60 (Part 2 of 4). Generated Schema source statements
Figure 60 (Part 3 of 4). Generated Schema source statements
Figure 60 (Part 4 of 4). Generated Schema source statements