Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Please post all of the rules for getting from the input to the output. Possibly there needs to be more input data to more completely demonstrate the requirement. How should a record 32 be processed? Is the data intended to be matched-pairs? What should happen if there are recordds 1, 2, and 3?
It will help if you post the recfm and lrecl of the input and desired output. You also need to post the positions of the key fields that control your process.
Keep in mind that you completely understand what you want do accomplish but many who read the request will not understand as well.