Joined: 02 May 2006 Posts: 7 Location: Charlotte, NC, US
I have a file having records distinguished by Record ID,
Record Id 010 - Header
020 - Sub Header
030/040/050/06 - Detail Record
My file has all the Detail records at top followed by the Subheader & Header can i have it so that the Header comes First followed by sub Header and all the corresoponding Detial records.
Is there any way i can do this using SORT.
Your example doesn't make sense unless there's a missing 010 record after the first 020 record. I'm going to assume that's the case. If not, then you need to explain why the 010 record from the second input group appears in the first output group instead of in the second output group.
Here's a DFSORT job that will do what I think you asked for. I added the missing 010 record. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.