Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
ICE201I is H
I am trying to join two files on keys and fill in the gap at bytes 4 and 5 of infile 2 with bytes 3 and 4 from infile 1 to get the required output. Was totally gobsmacked when the first attempt gave RC 0, but only until I looked at the output
Each of the infile 2 keys are being matched to each of the infile 1 keys. What I want is that the first record of infile 2 matched with the first record of infile 1 and so on.
I think that I could do it with SPLICE, but wondering if it was easier using JOINKEYS. I can not see anything in the JOINKEYS syntax documentation or anything in the JOINKEYS examples I've found to help.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
I agree with bill. You can number the records and then perform the match. By default JOINKEYS only gives you paired aka matched records. so you really don't need the indicator and INCLUDE condition on OUTFIL.
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Thank you Bill and Kolusu,
The examples have now given me a lot more knowledge into the workings of JOINKEYS. Seeing an example of working code for your own problem always seems to make the solution more understandable, especially for the use of the JNF1CNTL and JNF2CNTL DD statements.
Also excellent reference for future solutions when needed.
So, you really can teach an old dog some new tricks.
Now that you guys have so kindly given me the code, what shall I do until lunchtime