I am working on an requirement where there are 2 files :
FILE 1 - have all accounts with other details and will appear with duplicates.
FILE 2 - have only the account list.
All records in file 1 should be written to o/p file (with dups), provided those accounts are matching with that of file 2.
File 1:
100 XXXXX
100 XXXXY
121 XXXRR
122 RREED
File 2:
100
121
o/p file expected:
100 XXXXX
100 XXXXY
121 XXXRR
Please advise on how to get this requirement done via DFSORT/ICETOOL (SPLICE).
I have tried using SPLICE options like 'WITHALL', 'WITHANY', 'WITHEACH' etc. but the duplicates are getting removed and only 1 record is appearing in output file when there are many in file 1... Please suggest.
Joined: 28 Jan 2012 Posts: 287 Location: Room: TREE(3). Hilbert's Hotel
Hi Hari,
As d.sch. has already pointed out, you dont need a SPLICE but JOINKEYS.
Assuming that First three character is the key in both the files and you need all the data from file one only, and all the files are FB and LRECL=80, you can try this job:
The sample data shown is already sorted, so no need to let JOINKEYS do it again. By not specifying a JOIN statement, only "matched" records will be included, and the REFORMAT record can specify all the data needed from file F1.
Hey, it is your solution, I've just "tweaked" it for the data shown.
JOINKEYS sorts each data file by default (with OPTION EQUALS).
If either or both of the files are already sorted, then you want to tell JOINKEYS not to Sort, and you can avoid "sequence checking" as well.
If only a match is needed, no need to deal with unmatched for either file. If there is no match marker to drop off, then the REFORMAT record can specify the full and complete output.
I'm sure there are many thousands of JOINKEYS "out there" which work, but which re-sort sorted files :-)