I have a dataset with one record. The record layout is as follows.
I have a number in a field starting from position 1 thru 13 (with leading zeroes). Another number starting in position 18 (no leading zeroes). I want to take the number from position 18, subtract 1 and then compare with the number in position 1 thru 13. If the numbers are not equal, I want to set the RC (return code) to 4 or greater.
I do not have DFSORT, but have SYNCSORT and FILEAID. Can someone suggest a way to achieve this.
Try this job. If you have SYNCSORT you should be able to run it.
This will give a return code of 12 if the numbers are not equal.
Assuming the file is FB and LRECL=80
Thanks for posting this code. It worked well. I have a question though. The number of digits in the count value, here 10124, can vary. How does the statement OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) would look?
If the input is as given above all you need to change is
OUTREC=((18,05,ZD,SUB,+1),1,50,80:X) to
OUTREC=((18,X,ZD,SUB,+1),1,50,80:X) where X is the maximum length of your numeric field (Assuming it's less than or equal to 15 - In SYNCSORT the maximum for a ZD field is 15 digits)