I have a file which needs to be sorted based on keys. The key has duplicate occurences. For 1 key I need to sum the values of other fields under that key. Like this if there are many different keys for each of them the summned up fields have to be produced. The lines in between the '=' are just for understanding they don't have to be produced in the output file.
Key Company Name
File header: 0000
Key header: Key1 xxxxxxxxxxxxx
Key trailer: Key1 xxxxxxxxxxxxx sum of diff types of records
File trailer: total no under that key.
Please show an example of exactly what your input records look like and exactly what you want the output records to look like. What is the starting position, length and format of the key? What is the RECFM and LRECL of the input file?