Low values to Spaces using SORT
Low values to Spaces using SORT
There may be situation where you wish to replace the low values hex ('00') in a file to spaces hex ('40'). The following JCL can come handy for
such scenarios
Method 1: If position of low value char is not known and all such chars are to be
replaced by spaces
//STEP001 EXEC PGM=SORT//SYSOUT DD SYSOUT=*//SORTIN DD DSN=FILE.WITH.LOW.VALUES,// DISP=SHR//SORTOUT DD DSN=FILE.WITH.SPACES,// DISP=(NEW,CATLG,DELETE)//SYSPRINT DD SYSOUT=*//SYSIN DD *SORT FIELDS=COPYALTSEQ CODE=(0040)OUTREC FIELDS=(1,80,TRAN=ALTSEQ)/*
Method 2: If position of low value char is known and only that occurence needs to be changed
to spaces
The following sort job will change the hex of X'00' to X'40' at position 14th
//STEP001 EXEC PGM=SORT//SYSOUT DD SYSOUT=*//SORTIN DD DSN=KKDP.U8MBAF0A.V065.YPL.QSTM.QTRLY.G0024V,// DISP=SHR//SORTOUT DD DSN=KKDP.U8MBAF0A.V065.YPL.QSTM.QTRLY.G0024VV,// DISP=(NEW,CATLG,DELETE)//SYSPRINT DD SYSOUT=*//SYSIN DD *SORT FIELDS=COPYOUTREC FIELDS=(1:1,13,14:14,1,CHANGE=(14,X'00',X'40'))/*
Comments
Anonymous
Thu, 03/01/2012 - 11:50
Permalink
Method 1 not working
Method 1 not working for me.
Thanks,
Sumeet