I have a file having parent and child data in column1 and column2 respectively. I have a requirement to concat all the child from same parent in one record. How can we achive this through JCL ?
Expected Result shoold be like this : Input file :
Parent |Child
ABCDEFAAAA|1233444111
ABCWEEAAAA|3456544111
ABCDEFAAAA|3435677111
HFFDDDAAAA|6444554111
ABCDEFAAAA|2424234111
HFFDDDAAAA|4334456111
Output should be like this
Parent |Child
ABCDEFAAAA|1233444111,3435677111,2424234111
ABCWEEAAAA|3456544111
HFFDDDAAAA|6444554111,4334456111
As Martin packer pointed out, it can be done in a single pass of data and get the desired results. Here is a sample which can handle upto 99 children per parent, but only the first 10 are handled as OP mentioned that the max is only 8.
The output of this is