I have a file which have File Header(Record Type=00),Batch Header(Record Type=01),Detail Record(Record Type=03),Batch Trailer(Record Type=04),File Trailer(Record Type=99).
My file can have multiple Batch header and Batch Trailer but only 1 File Header and 1 File Trailer.
I have defined the file layout as:
File Record
File Header redefines File Record
Batch Header redefines File Record
Detail Record redefines File Record
Batch Trailer redefines File Record
File Trailer redefines File Record
Now my requirement is I need to sort the detail record based on two 3 bytes fields one starts at position 23 and the second field starts at position 26.
The Headers(file & batch) and Trailers(file & batch) have different type of data at the above postions 23 and 26.For which I can not put a simple sort on the fields.
Also in my output file I need only the details record to be sorted on the field specified keeping the header trailer at their respective place.
Please help to resolve this.