Page 1 of 1

Data required from both files depending on some keys

PostPosted: Tue May 10, 2016 6:47 pm
by Papya013
Hi Team,

I have two sorted files FILE1 and FILE2 which has common field xxxx, I am looking for data in output file from FILE2 if the key matches and data from FILE1 if key does not matches.

could you please suggest SORT card using JOINKEYS.

Regards,
Balesh GG

Re: Data required from both files depending on some keys

PostPosted: Tue May 10, 2016 9:29 pm
by BillyBoyo
Yes, it is JOINKEYS you want. You have a very simple situation, which is easily covered in the manuals. Have a look at the DFSORT Getting Started manual. The JOINKEYS statement is very simple, and since your data is already ordered, you want to specify SORTED,NOSEQCK. If you don't specify SORTED, it will be SORTed again, by default, which you never want.

You'll need a JOIN statement, to allow matches, and the mismatched file you want. A REFORMAT statement to give you the data, and the match-marker in the REFORMAT so you easily know what type of REFORMAT record you have.