The file in question is FB with LRECL=116. First six bytes belong to a code and the next 9 bytes are for an account number.
As per my new requirement I need the records in red at the bottom of the file. Basically I want all the records with code = 200105 and account no = 123456702 at the bottom of my file. Other records must be sorted the way it was done before. Now can I achieve this by just modifying the existing sortcard or do I have to introduce one extra sort step? I tried searching for such an example where sorting is done only at the OUTFIL level but couldn't find anything.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Use INREC with IFTHEN=(WHEN=(logexp) to identify the keys you want to outsort. Add (front or back of record, depending on variable/fixed) a byte set to a value higher than space. Sort on that byte as the major key. Remove that byte with BUILD in your OUTFILs.
OP needs to evaluate the full 15 bytes not just the key. So if there is another account number with the same key then it will also be pushed to the bottom.