The MERGE statement takes two or more identically sequenced files and
combines them according to the key values you specify. During the
process, it makes records available, in merged order, to routines in
OUTPUT PROCEDURE or to an output file.
Format -
MERGE mergefile
{ ON { ASCENDING } KEY { mergekey } ... } ...
{ { DESCENDING } }
[ COLLATING SEQUENCE IS alpha ]
USING infile { infile } ...
{ OUTPUT PROCEDURE IS first-proc [ { THRU } end-proc ] }
{ [ { THROUGH } ] }
{ GIVING { outfile } ... }
Additional Information:
explode
extract