How to replace a smaller string with bigger string without impacting the adjacent fields using DFSORT?

286 Views Asked by At

I have below input file: Field1=(1-7) field2= (8-12) field3= (13-19) ABC'DEF12345GHIJ'KL

I need my Output file of same field length as below: ABC?'DE12345GHIJ?'K

Need to replace " ' " by " ?' " using DFSORT. How to achieve this? Please help.

1

There are 1 best solutions below

0
On

If your input file contains:

ABC'DEF12345GHIJ'KL 

Using the following control cards:

RECORD TYPE=F,LENGTH=20
SORT FIELDS=COPY
INREC FINDREP=(IN=(C''''),OUT=(C'?'''))  * Replace ' with ?'
OUTREC BUILD=(1,20)  * Truncate to 20 Bytes
END

Your output file will contain:

ABC?'DEF12345GHIJ?'K

This was verified using AHLSORT for Windows x64, Version v14r3-87-g811342a2 but should work the same using DFSORT or SYNCSORT on z/OS.