Create a customized extract file format
JCL to create a customized extract file format
02 //STEPLIB DD DISP=SHR,DSN=BMC.PFP.LOAD
03 // DD DISP=SHR,DSN=IMSVS.RESLIB
04 // DD DISP=SHR,DSN=IMSVS.DFSMDA
05 //IMSACB DD DISP=SHR,DSN=IMSVS.ACBLIB ---> IMSACB DD is not required in a managed ACB environment instead the active directory is used to refer the current control blocks.
06 //OAREA001 DD DSN=BMC.PFP.USEROUT1,DISP=(,CATLG,DELETE),
07 // UNIT=SYSDA,SPACE=(CYL,(5,1),RLSE)
08 //OAREA002 DD DSN=BMC.PFP.USEROUT2,DISP=(,CATLG,DELETE),
09 // UNIT=SYSDA,SPACE=(CYL,(5,1),RLSE)
10 //OAREA003 DD DSN=BMC.PFP.USEROUT3,DISP=(,CATLG,DELETE),
11 // UNIT=SYSDA,SPACE=(CYL,(5,1),RLSE)
12 //PFPSYSIN DD *
13 EXTRACT DBD=PFPSAMP,IAREA=ALL,
EXTRACT_FORMAT=USER,
14
SEGMENT_RECORD_PREFIX=(X'0003',
15 :2X :=SEGMENT_CODE,
16 SEGMENT_NAME)
17
USER_
RECORD
BREAK=(AREA,BEFORE),
18
FIELDS=(X'0000',
19 AREA_NAME,
20 :2X :=AREA_NUMBER,
21 :'%YYYY%%MO%%DD%%24%%MI%%SS%':=SYSDATETIME())
22 USER_RECORD BREAK=(AREA,BEFORE),
23 FIELDS=(X'0001',
24 DBD_NAME,
25 DBD_AREAS,DBD_SEGMENTS)
26 USER_RECORD BREAK=(AREA,AFTER),
27 FIELDS=(X'0004',
28 X'0000',
29 SEGMENT_COUNT(1),
30 SEGMENT_COUNT(),
31 F'0')
/*
Line no. | Comments |
---|---|
01-04 | EXEC and STEPLIB statements for Fast Path/EP offline execution. |
05 | IMSACB DD statement used for database processing. |
06-07 | Extract output file for area PFPSAMP1. |
08-09 | Extract output file for area PFPSAMP2. |
10-11 | Extract output file for area PFPSAMP3. |
12 | PFPSYSIN DD for Fast Path/EP control statements. |
13 | Defines DEDB name for EXTRACT process. All areas are input. Data is extracted from all segments for all areas, using EXTRACT_FORMAT=USER. This format enables use of any customized format that is needed. The areas are dynamically allocated from their dynamic allocation members in the IMSVS.DFSMDA data set in the STEPLIB concatenation. |
14 | All segments are written to the output file. Segment records will have a common prefix that will be written first, before each segment data (segment data includes LL field for variable length). The contents of the common prefix is specified by using the SEGMENT_RECORD_PREFIX keyword. The first prefix field for the segment record is x’0003’. |
15 | The next field of the segment prefix is performing an assignment (:=) of the one-byte built-in variable of SEGMENT_CODE into a two-byte assignment variable (:2X) |
16 | The last field of the segment prefix is an eight-byte built-in variable for SEGMENT_NAME. |
17, 22 | For each area, two header records are produced which will be written first (AREA,BEFORE) in the extract output file. |
17 | The first header record is created by specifying the USER_RECORD subcommand. The BREAK keyword signifies that this record is to be written before the rest of the area information is written (AREA,BEFORE). |
18 | The FIELDS keyword specifies the content of the header record, as follows: record identifier of X’0000’ |
19 | followed by an 8-byte built-in variable of AREA_NAME |
20 | Next is the assignment (:=) of 1-byte built-in variable AREA_NUMBER (2-byte built-in variable for IMS version 8.1 and above) into a two-byte assignment variable (:2X) |
21 | Next is a date field with an assignment (:=) of 12-byte calendar date, of the built-in function SYSDATETIME() into the specified string literal. The literal indicates the time in military time by specifying hours with %24%. |
22 | The second header record is created by specifying the USER_RECORD subcommand. The BREAK keyword signifies that this record is to be written before the rest of the area information is written. |
23 | FIELDS keyword specifies the content of the second header record, as follows: record identifier X’0001’ |
24 | followed by an 8-byte built-in variable for DBD_NAME |
25 | Next are the built-in variables for the number of DBD_AREAS and the number of segment types for DBD_SEGMENTS, each specified as two fixed bytes. |
26 | An area trailer record follows all segment records from the area. The area trailer record is created by specifying the USER_RECORD subcommand. The BREAK keyword signifies that this record is to be written after the rest of the area information is written (AREA,AFTER). |
27 | FIELDS keyword specifies the content of the trailer record, as follows: record identifier X’0004’ |
28 | followed by two bytes of zeroes (X’0000’) |
29 | Next is the 4-byte built-in function of SEGMENT_COUNT (1), giving the total number of root segments to be processed. The root segment is indicated by the segment code ‘1’ (default with no parm given). |
30 | Next is the 4-byte built-in function of SEGMENT_COUNT(), giving the total of all segments processed. |
31 | Next is 4 bytes of zeroes as specified by (F‘0’) using the default length 4 for the ‘F’ data type. |
The following table provides some examples of the data output from the JCL that is executed to create a customized extract file format.
Format | Data output | Explanation |
---|---|---|
Char Hex | ..PFPSAMP1..19990520175735 00DCDECDDF00FFFFFFFFFFFFFF 00767214710119990520175735 | Record=x’0000’ Areaname=PFPSAMP1 Area number=x’0001’ Date-time=1999/05/20| 17:57:35 |
Char Hex | ..PFPSAMP1.... 00DCDECDDF0000 01767214710306 | Record=x’0001’ dbdname=PFPSAMP Number of areas=x’0003’ Number of segments=x’0006’ |
Char Hex | ....SEGA ..4033422007439 0000ECCC444400FFFFFFFFFFFFF 0301257100000F4033422007439 | Record type=x’0003’ Segment code=x’0001’ Segment name=SEGA LL of segment data=x’000F’ Followed by segment data |
Char Hex | ....SEGB ...... 0000ECCC44440000964 03022572000007801C0 | Record type=x’0003’ Segment code=x’0002’ Segment name=SEGB LL of segment data=x’0007’ followed by segment data |
Char Hex | ....SEGD ..... PREVIOUS BILLED AMOUNT 66.36 0000ECCC44440301044DDCECDEE4CCDDCC4CDDEDE4FF4FF 0304257400000A0FF007955964202933540146453066B36 | Record type=x’0003’ Segment code=x’0004’ Segment name=SEGD LL of segment data=x’003A’ followed by segment data |
Char Hex | ................ 00000005001F0000 0400001B00FD0000 | Record type=x’0004’ Half word zeroes=x’0000’ Count of segment 01=x’0000015B’ Total segment count=x’00001FFD Word of zeroes=x’00000000’ |