so have set of data such this:
mxyzd1 0000015000 mxyzd2 0000016000 xyzmd5823 0000017000 i need use dfsort data:
123xyzd1 0000015000 123xyzd2 0000016000 xyz123d5820000017000 so mean is: replace character 'm' '123' without overwriting second column, truncate data before second column (which starts @ pos 11).
so far i've been able replace data can't prevent of data of getting shifted, code far:
sysin data * sort fields=(1,1,ch,a) outrec findrep=(in=c'm',out=c'123',startpos=1,endpos=10, maxlen=20,overrun=trunc,shift=yes) dataend *
the problem facing all data on record shifted right if findrep change increases length, , left if findrep change decreases length. change in length of changed data affects entire record. have discovered yourself.
to put way, findrep not know fields (columns best termed that) knows records, when looking @ portion of record, changes in length reflect on rest of record.
there no way write findrep avoid this.
option copy inrec ifthen=(when=init, overlay=(21:1,10)), ifthen=(when=init, findrep=(in=c'm', out=c'123', startpos=21)), ifthen=(when=init, build=(21,10, 11,10)) this put data 1,10 temporary extension record. findrep on temporary extension only. take first 10 bytes of extension , put them position 1 length of 10.
Comments
Post a Comment