Can you please help me to address this issue? I would like to do a check on a file that has several records. If the difference between each record in a set should be only 1 then write MAX number of it to output file. The first 6 characters of a set forms the key. If comparison is greater than 1 then write wrong set to error file.
Joined: 10 May 2007 Posts: 2406 Location: Hampshire, UK
Why is SELVIAS0093 not in your output dataset - it is more than one different from the previous two entries? Why is GORAPAK1291 in your output dataset - you have nothing to compare it to so it cannot be more than one different?
Usual requirements: LRECL & RECFM of input/output.
Your final column arises from my poor description, it was supposed to be SEQ from the PUSH on WHEN=GROUP. However, you already have a sequence number for the group, so that final column is not needed anyway.
Now, if you add column two to column 3, and arrive at your sequence number from your input, then that record is in sequence. You you can arrange that for INCLUDE=/OMIT= on OUTFIL, and use the OUTFIL reporting that I suggested to get the final one from a good group.
However, other than as an exercise, you can forget that for now, because the "requirement creep" kills this solution. You don't want groups where there is only one record (GORAPAK) and you can't get conditional processing for TRAILER3.
All on the bad file, because 0103 after discarding the others is a unique record, which you don't want?
Arun Raj was discussing another idea, but I think you've killed both of what we had so far. There is a third at least, but what we need to see now is sample input which covers all the cases you may meet with your data, and expected output files for those samples. All in one post, in the Code tags to preserve formatting.
Bill and Arun, thank you very much for the details. I could have used MAX with DUPKEYS to get my MAX record but I am trying to figure out which set went out of sequence and get that to error output file so that it can be examined and do the necessary patch-up work to avoid batch abend. While, this could have been done very easily using a COBOL, it requires a program name, compilation and so on. I really do not know whether Syncsort could achieve it and if it does, how? I do not have a slightest idea. I am not coding furhter on your suggestion, because you said that idea is given up !
Now, I must admit that I am really confused after reading Bill's description of different possibilities.