Thanks for your help.
You solution will delete all duplicates in both the files, if I am not wrong.
But my requirement is if the records which are in file 2, matches with file 1, then the record should NOT write to output file. But for ex if there are duplicate records in file 2, but no corresponding records in file 1, then I need to write all the records even though they are duplicates in file 2, to output file.
Pl let me know, if I am confusing.
ex:
file 1:
Code:
1 aaa randy
2 bbb john
2 bbb john
4 ddd annie
file 2:
Code:
1 aaa randy
1 aaa randy
3 ccc mary
3 ccc mary
2 bbb john
Hi Priyesh,
will the steps work for multiple records, if there in file 2, in the example you shown below. I am getting error if file 2 has many entries... 'DUPLICATE SYMBOL DEFINITION'
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Beeru,
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
Beeeru... Pls try below code, if it works... I really can't test it before posting due to changed weather now a days...
Anyway, Frank would be coming with a panacea... regardless of the result of this code...
Frank... I m sorry, I know its not advisable to interfere when you are already involved in the SORT posts but couldnt resist curiosity.
I appreciate all your efforts in helping me.
I cant delete any of the duplicate entries from file 2, if the corresponding record is not present in file1. So cant do step 2 of your solution.
Anyway, I am trying out your sulution and see whether I can play around to get the desired result.
Once again I am thankfull to Priyesh and Frank for there efforts.
Suggested solution by Frank is working....w/o any changes.
May be it was my fault that when I was testing, file1 entries are appended with some junk characters at the end.
I apologize for this.
Appreciate all your help, guys. You are wonderfull.
I am sorry to say that, the function is not working correctly
With your solution, the output file is not writing more than 2 duplicate records from file 2 and which are not in file 1.
ex:
file 1
1 aaa randy
2 bbb john
2 bbb john
3 ccc mary
4 ddd annie
file 2:
1 aaa randy
1 aaa randy
1 aaa randy
3 ccc mary
3 ccc mary
3 ccc mary
3 ccc mary
2 bbb john
5 eee ben
5 eee ben
5 eee ben
5 eee ben
5 eee ben
outfile:
5 eee ben
5 eee ben
actually it is supposed to print all 5 entries of file 2.
any help...is appreciated.
Note: Priyesh, with your solution too, I am getting the same issue. But in yur case I am getting only one record to outfile from file 2, even though they are more than 1 record in the file. Also looks like there is no keyword 'KEEPALLDUPS', so I deleted that option from your solution as it is default option.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
beeru,
I tested with the data you originally gave me which had two dups at the most, so I didn't notice that more than two wouldn't work. To get all of the dups, you just need to add WITHALL to the SPLICE operator in the job I gave you.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
WITHALL is a separate keyword from WITH(p,m). You can't specify WITHALL(p,m). Also KEEPALLDUPS is NOT a valid keyword. KEEPNODUPS and KEEPBASE are valid keywords.
I don't know what you're trying to do, so it's hard to comment on how to do it. Show me an example of the records in each input file and what you expect for output, and I'll show you how to do it.