Joined: 28 Jan 2012 Posts: 310 Location: Room: TREE(3). Hilbert's Hotel
Bill has already pointed out, that there are duplicates in your sample. You can try the something similar to the below job which uses SPLICE and WITHALL to handle duplicates. If you don't have duplicates, you can remove the WITHALL parameter.
Okay, I just tried it, and I'm getting everything from File B, reformatted of course. So when there is a match between the two input files, data in the second field of File A shows up in the third field of the results file, and when there is not, the third field contains just spaces.
The ultimate goal is to have a results file with only those records from File B which match File A. I can sort the results to exclude those records with spaces in the third file, but I'd rather do it all in one step.
Here's the problem: I supplied a File B that would always find a match in File A, which is not reality-based in this application. My apologies.
(I apologize for my absence. I've spent nearly all day on a production problem for a legacy system caused by one of the business users messing with last night's batch schedule, not telling any of us what was going on, then complaining this morning that things didn't go well. To think I get paid to have all this fun. What made me think I could work on new development today? Silly me.)
Okay, so when I run the JCL you so helpfully provided with the test data I created for this example, it works fine. When I use the test files I created from the actual database, I get the results described in my prior message.
Rohit Umarjikar, you are of course correct about the duplicates. I was thinking of the account numbers (second field) in File B as making each record unique, which they are, but there were definitely duplicate supplier numbers (first field) and they were what needed to be matched on File A. I apologize for any confusion my blinkered view caused.
I appreciate the link to the SPLICE command, and I will examine it to see where I was getting things wrong (quite possibly the very thing mentioned above). I have the "DFSORT tricks" manual but so many of the tricks I've tried are unsupported by my employer's current release that I have pretty much given up using it as a resource.
mistah kurtz, the tweaks you applied to the BUILD and SPLICE statements worked beautifully. Your help has been an invaluable life-saver during these days of ever-increasing work loads with no time to learn and hone new skills. I'm sorry I had such a hard time focusing on what you were trying to show me, and that I made it more difficult with my unclear problem statements.