- I have a master file of all valid keys allowed on a data file
- I need to compare the data file against the master file and only retain records that have a matching key on the master file
Other criteria/issues:
- the data file may have zero, one, or many records for each key on the master file
Assume the key to be the one byte in column 1. Here's a data file:
A1
A2
A3
B1
B2
C1
D1
D2
E1
Here's the master file:
A
D
E
I want to end up with:
A1
A2
A3
D1
D2
E1
Can this be done in one pass with DFSORT or ICETOOL? Apologies if this has already been answered elsewhere, I did search for a bit but didn't come up with anything.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Can this be done in one pass with DFSORT or ICETOOL?
Yes, assuming that
1) There's some way to distinguish the records in the Master File from the records in the Data File. For your example, the records in the Master file have a blank in position 2 whereas the records in the Data file have a non-blank in position 2, so we can use that to distinguish them.
2) You have z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) installed so you can use INREC with SPLICE. If you see 'ICE201I E' in //DFSMSG, you have that PTF. If you see 'ICE201I 0' in //DFSMSG, you do not have that PTF. Without that PTF, the one pass solution won't work, but you could do it in multiple passes.
I also assumed that your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Frank - I thought I'd given you all the info you needed, you're right, I didn't specify that you can distinguish between the files and it is true that you can.
Thanks once again for the impossibly quick and concise reply.
The only change I made to the code was to exclude the inclusion criteria on the output file (I would fix that later once I got the data coming out as I wanted). Did I mess something up? Another factor to consider is that a key in the key file does not have to appear in the data file.
Frank - I had taken out the include statement and wrote out the full 82 bytes to see what was going into in columns 81 and 82. I was getting low values, not 'VB' or 'VV'.
Now reading your original note closer I see my real problem: My site doesn't have the latest PTF installed so I need to use the mutliple pass method. I went this route and everything is ok now.
Thanks again for your help and I apologize for not reading your original note more closely.