I have the following requirement and i tried to find a solution searching old posts in the forum but couldn't find one.
The requirement is i have a sequential file fixed length 40 bytes.
The file has multiple header records and under each header, multiple detail records. The output file should have header records as-is and detail records sorted on field2 and field3 should be summed up using field 2 as key. (After summing, the field4 in detail can be from any record of the key, there is no restriction)
Field1: 1 byte, always have value 1 to say header.
Field2: 4 bytes, any value
Field3: 35 bytes any value
Field1: 1 byte, always have value 2 to say detail
Field2: 4byte, any value
Field3: 3 byte, any 3 digit number
field4: 32 byte any value