I want to delete 501 records based on 5 character activity code from the test file with 38,792 records.
As there are 501 record I can't write a omit condition.
I need to use sort join card but my prombelem is this 5 charcter activity code is starting from 46th column for some records and 47th column for others.
So what can I do?
The question is unclear with many details missing, but here's something which may help another searcher:
This is using two input files, INA and INB.
INA is already in sequence (so specify SORTED,NOSEQCHK on the JOINKEYS for it), and is fixed-length 80-byte records.
INB is not already in sequence, because it is a mixture of different files, all are fixed-length 80-byte records.
In JNF2CNTL, only the key from the second file is extracted, as no other data is required from that file. The key is sourced from different places depending on the record-type. The file will be sorted automatically (with OPTION EQUALS set) before the JOIN itself.
The JOIN is for matches, and unmatched records from F1 (INA).
The ? in the REFORMAT statement is the "match marker" and it will be automatically set to B (both) for a match and 1 (in this case, only one is possible due to the ONLY on the JOIN statement) for an unmatched record from F1.
Of those that match, you want to ignore the first 501. So, set up a sequence number which is only incremented for the matching records.
Then on OUTFIL, OMIT= for those matched records which have a sequence less than or equal to the 501 count.
The output on SORTOUT will be all the records from the INA file, except the first 501 which matched.