Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 8: JCL Sort & Merge


OUTREC FINDREP

Reformat each record by doing various types of find and replace operations.

Example :-

Input file:-

----+----1----+----2----+----3 JOHN MON 08000 AKSHAY TUE 10000 SMITH WED 25000 JOHN THU 28000 STEVE MON 20000 VIJAY XXX 24000 VIJAY SUN 30000

Requirement: Find if day-of-week is SUN, then replace it with ‘XXX’ and write it to output file

JCL Code Solution:-

//SORTSTEP EXEC PGM=SORT //SORTIN DD DSN=DEPT.EMPL.DATA.OUTPUT1,DISP=SHR //SORTOUT DD DSN=DEPT.EMPL.DATA.OUTPUT2, // DISP=(,CATLG,DELETE), // DCB=(RECFM=FB,LRECL=30,BLKSIZE=0), // UNIT=TEST,SPACE=(CYL,(50,10),RLSE) //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD * SORT FIELDS=COPY OUTREC FINDREP=(IN=C'SUN',OUT=C'XXX') /*

Output file:

----+----1----+----2----+----3 ****************************** JOHN MON 08000 AKSHAY TUE 10000 SMITH WED 25000 JOHN THU 28000 STEVE MON 20000 VIJAY XXX 24000 VIJAY XXX 30000






© copyright mainframebug.com
Privacy Policy