Example 4: Extracting segments in user-defined format

The following figure shows example JCL that is used to extract segments in user-defined format.

In this example, the following records will be written to the output file that is specified by the OAREA001 DD statement:
  • The number of areas in a DBD, which is defined by the USER_RECORD subcommand, is written as the database-level header.
  • The area name, which is defined by the USER_RECORD subcommand, is written as the area-level header.
  • Each segment record with its segment code, which is defined by the SEGREC_PREFIX keyword, is written in the prefix portion of the segment records, and the segment concatenated key and its length, which is defined by the SEGREC_SUFFIX keyword, is written in the suffix portion of the segment records.
  • The area name, which is defined by the USER_RECORD subcommand, is written as the area-level trailer.
  • The number of areas in a DBD, which is defined by the USER_RECORD subcommand, is written as the database-level trailer.
Figure 1. Extracting segments in user-defined format
 //HFP      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,CATLG),DSN=HPFP.OUTFILE,SPACE=(CYL,(5,1)),
 //            UNIT=SYSDA,VOL=SER=HFPVOL
 //HFPRPTS  DD SYSOUT=*
 //HFPPRINT DD SYSOUT=*
 //HFPSYSIN DD *
  GLOBAL
    DBRC=YES
  EXTRACT
    DBD=DEDBJN22,
    IAREA=(DB22AR0),
    EFORMAT=USER,
    SEGREC_PREFIX=(SEGMENT_CODE),
    SEGREC_SUFFIX=(SEGMENT_CKEY_LENGTH,SEGMENT_CKEY)
  USER_RECORD
    BREAK=(DATABASE,BEFORE),
    FIELDS=(DBD_AREAS)
  USER_RECORD
    BREAK=(AREA,BEFORE),
    FIELDS=(AREA_NAME)
  USER_RECORD
    BREAK=(AREA,AFTER),
    FIELDS=(AREA_NAME)
  USER_RECORD
    BREAK=(DATABASE,AFTER),
    FIELDS=(DBD_AREAS)
 /*