OUTREC Extending records with OVERLAY
OUTREC Extending records with OVERLAY Example
Scenario - Overlay 'dept' with 'DEPT' in all rows and multiply marks with 10. Place the result from 85th position (extending the record length to 88).
Input File - MATEPK.SORT.INPUT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 00001 student1 dept1 560 00003 student3 dept2 520 00004 student4 dept1 540 00005 student5 dept2 500 00002 student2 dept3 510
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MATEPKD JOB (123),'MTH',NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MATEPK.SORT.INPUT01,DISP=SHR
//SORTOUT DD DSN=MATEPK.MERGE.OUTPUT,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC OVERLAY=(30:30,4,TRAN=LTOU,
85:45,3,ZD,MUL,+10,TO=ZD,LENGTH=4)
/*
Output -
-----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--- 00001 student1 DEPT1 560 5600 00003 student3 DEPT2 520 5200 00004 student4 DEPT1 540 5400 00005 student5 DEPT2 500 5000 00002 student2 DEPT3 510 5100
Explaining Example -
- OUTREC OVERLAY=(30:30,4,TRAN=LTOU,..) - Converts the data lower to upper from 30th position of length 4 and writes to output from 30th position.
- OUTREC OVERLAY=(..,85:45,3,ZD,MUL,+10,TO=ZD,LENGTH=4) - the data from 45th byte multiplies with 10 and writes the result to output of the length 4 from 85th position.
Note! The OVERLAY parameter of the OUTREC statement can be used to overlay specified columns with reformatting items, without affecting the rest of your reformatted record.
All of these reformatting features can be used with the OVERLAY parameter of the INREC statement and OUTFIL statement, as well as with the OUTREC statement.
All of these reformatting features can be used with the OVERLAY parameter of the INREC statement and OUTFIL statement, as well as with the OUTREC statement.