I have to find the way to make a report with the following information:
Input file
BH0125JO29
PT220010731120000001000
PT220010731120000001000
BH0125JO30
PT220020831120000001000
PT220020831120000001000
PT220020831120000001000
PT220010731120000001000
PT220010731120000001000
BH0125JO30
PT220020831120000001000
PT220020831120000001000
PT220020831120000001000
Output file should be
JO29 22001 07/31/12 2,000.00
JO30 22002 08/31/12 3,000.00
JO30 22002 08/31/12 3,000.00
I need to include this info from the header JO29,JO30 and 22001-22002 , 07/31/12- 08/31/12 from the details. Also need to sum the amounts in the detail (2 records with 1000 in the first group and 3 records with 1000 in the second one). Key is in the header (JO29-JO30) and match with the field from 3-7 in the details (22001 in the first group and 22002 in the second one).
Is there a way to build the output using SORT instruction? I tried but I couldn't.
Code'd