What follows each XX???? ID are groups. They can be up to 8 positions long. When rolling up, there should be only a maximum of 7 groups per line beginning in positions 10, 19, 28, 37, 46, 55, and 64. If there are more than 7 groups listed for an ID, a new line should started.
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed that the records were already in sorted order by positions 1-6 as shown in the example. I assumed that the input file has RECFM=FB and LRECL=80. The job can be changed appropriately if these assumptions are incorrect.
Joined: 14 Jun 2006 Posts: 331 Location: Jacksonville, FL
Frank..Thank you for your solution. I am becoming a believer that ICETOOL/DFSORT can do just about anything to manipulate data. I would have never been able find a solution using the manual after seeing your rather complex solution.
Also, thanks to gcicchet for testing your solution and also much thanks to ibmmainframesyntel for the final KEEPNODUPS suggestion that made the output perfect. Without KEEPNODUPS, I had 1098 records on my output file. With KEEPNODUPS, the total output records was 1161 that took into account records that were missing because those IDs were associated with 8 or 15 groups each (where the last group was not being accounted for).
I tested with the input you gave me. Unfortunately, I didn't think to test other variations or I would have realized KEEPNODUPS was needed. I just got in and saw the new posts and that ibmmainframesyntel figured it out (saves me the trouble). I've modified the job to use KEEPNODUPS for future reference.