|
Using OUREC in SORT JCL - Example
|
OUTREC in SORT JCL - Example 1
If you want to add sequence number to the output data after sorting input data.
Here is the OUTREC SORT card.
Inputfile for SORT JCL
10 suresh 20000 01 20120203 34
20 NARENDRA 40000 06 20120925 AB
30 jacob A 25000 07 20111018 1A
40 RAMESH 34000 03 20120610 2C
50 Kishore 50000 02 20120408 45
INREC in SORT JCL
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,35,60:SEQNUM,6,ZD)
/*
//* copyright www.mainframegurukul.com
Explanation - First 35 bytes will be copied to outputfile &
sequence number will be added at 60th position in the outputfile.
Outputfile from SORT JCL -
10 suresh 20000 01 20120203 34 000001...
20 NARENDRA 40000 06 20120925 AB 000002...
30 jacob A 25000 07 20111018 1A 000003...
40 RAMESH 34000 03 20120610 2C 000004...
50 Kishore 50000 02 20120408 45 000005...
******************************** Bottom of Data ********************
OUTREC OVERLAY in SORT JCL - Example 2 -
|
OVERLAY is used to change the certain columns in the record without effecting other columns.
Input File -
10 suresh 20000 01 20120203 34
20 NARENDRA 40000 06 20120925 AB
30 jacob A 25000 07 20111018 1A
40 RAMESH 34000 03 20120610 2C
50 Kishore 50000 02 20120408 45
OUTREC OVERLAY SORT CARD -
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(1:1,35,36:13,5,ZD,DIV,+100,TO=FS,LENGTH=4)
/*
Output File -
10 suresh 20000 01 20120203 34 +200
20 NARENDRA 40000 06 20120925 AB +400
30 jacob A 25000 07 20111018 1A +250
40 RAMESH 34000 03 20120610 2C +340
50 Kishore 50000 02 20120408 45 +500
******************************** Bottom of Data ****
The value at 13th position in the input file will get divided by 100
and resultant vlaue will be converted to FS value with length 4. The
result will get moved to 36th position in the output file.
OUTREC Reference from our discussion forum
For complex OUTREC and INREC SORT JCLs. Refer below
discussion at mainframegurukul SORT forums.
Hexadecimal to decimal conversion - SORT JCL INREC OUTREC
SORT JCL - SORTING A VB FILE - INREC OUTREC PARSE BUILD
Sort jcl - report writer queries using OUTREC
|
|