Replace values in a file
The value in a file can be replaced in JCL using FINDREP command as shown below:
Sample Input :
Mainframe wordd |
FINDREP command can be used to find and replace the contents in the input record.
//EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<input file>,
// DISP=SHR
//SORTOUT DD DSN=<output file>,
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
OUTREC FINDREP=(IN=C’Wordd’,OUT=C’World’)
/*
IN and OUT statement can also be replaced by INOUT as below:
OUTREC FINDREP=(INOUT=(C’Wordd’,C’World’))
OutputMainframe wordd
World of Mainframe
MainframeWorldly
Hellowordd Mainframe!