OUTREC Data Translation
OUTREC Data Translation Example
Scenario - Convert all lower case characters to upper case.
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----+
//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 *
SORT FIELDS=(1,5,CH,A)
OUTREC FIELDS=(1,10,11,22,TRAN=LTOU,33,40)
/*
Output -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 00001 STUDENT1 DEPT1 560 00002 STUDENT2 DEPT3 510 00003 STUDENT3 DEPT2 520 00004 STUDENT4 DEPT1 540 00005 STUDENT5 DEPT2 500
Explaining Example -
- OUTREC FIELDS=(1,10,..) copies 10 bytes from byte 1 from input file to output file as it is.
- OUTREC FIELDS=(..,11,22,TRAN=LTOU,..), LTOU applies from 11th byte to 22nd byte and all the lower case letters in between will convert to upper case.
- OUTREC FIELDS=(..,33,47) copies from 33rd to 80th byte will be copied from input file to output file as it is.