It is irrelevant that the input is two generations of the same GDG. They are just sequential files for all that anything is known by a program.
It would be a very simple JOINKEYS application for your Sort product.
Is that really the data, or are you going to produce the actual code afterwards?
What are the RECFMs of the inputs and output?
What is your Sort product? If you don't know, look at the messages out of a Sort step. If they start ICE it is DFSORT, if WER it is Syncsort.