Example 3: Creating a test database

The following figure shows example JCL that is used to extract segments with the selection criteria and to create a test database.

There are two steps in this example. The first step is an extract step to create an output file for the segments with the selection criteria. In this step, every fifth occurrence of the segment with segment name ROOTSEG and their dependent segments will be retrieved and written to the output file with the unloaded segment records file format. The second step is a reload step to create a test database by using the output file. In this step, the output ADS DD statement name (DB22AR0) and the DS name (HPFP.TEST.DB22AR0) are dynamically defined and allocated by using the ODSNMASK parameter and the ALLOCATE subcommand.

Figure 1. Creating a test database
//**************************************
//*  EXTRACT STEP                      *
//**************************************
//EXTRACT  EXEC PGM=HFPMAIN0
//STEPLIB  DD DISP=SHR,DSN=HPFP.SHFPLMD0
//         DD DISP=SHR,DSN=IMSVS.SDFSRESL
//         DD DISP=SHR,DSN=IMSVS.PGMLIB
//IMSACB   DD DISP=SHR,DSN=IMSVS.ACBLIB
//IMSDALIB DD DISP=SHR,DSN=IMSVS.MDALIB
//OAREA001 DD DISP=(NEW,PASS),DSN=&&OAREA001,SPACE=(CYL,(5,1)),
//            UNIT=SYSDA
//HFPRPTS  DD SYSOUT=*
//HFPPRINT DD SYSOUT=*
//HFPSYSIN DD *
 GLOBAL
   DBRC=YES
 EXTRACT
   DBD=DEDBJN22,
   IAREA=(DB22AR0),
   EFORMAT=DBT,
   SORT=YES
  SELECT SEG=ROOTSEG,
   EVERY=5 
/*
//**************************************
//*  RELOAD STEP                       *
//**************************************
//RELOAD   EXEC PGM=HFPMAIN0
//STEPLIB  DD DISP=SHR,DSN=HPFP.SHFPLMD0
//         DD DISP=SHR,DSN=IMSVS.SDFSRESL
//         DD DISP=SHR,DSN=IMSVS.PGMLIB
//IMSACB   DD DISP=SHR,DSN=IMSVS.ACBLIB
//IAREA001 DD DISP=(OLD,DELETE),DSN=&&OAREA001
//HFPRPTS  DD SYSOUT=*
//HFPPRINT DD SYSOUT=*
//HFPSYSIN DD *
 GLOBAL
   DBRC=NO
 RELOAD
   DBD=DEDBJN22,
   IAREA=(DB22AR0),
   OAREA=(DB22AR0),
   ODSNMASK='HPFP.TEST.&AREA'
  ALLOCATE
   OAREA=(DB22AR0),
   SPACE=(CYL,5),
   VOLSER=HFPVOL
/*