View previous topic :: View next topic |
Author |
Message |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Tue Jul 05, 2011 7:44 pm Post subject: SPLICE problem |
|
|
Hi,
I am using SPLICE to get unmatched records from two files.
but in unmatched output files duplicate records are getting eliminated on the keys on which I am splicing. I am using KEEPNODUPS even then duplicate record which are unmatched are written output file.
For example
Inputs files
Filein1:
1111
2222
2222
3333
Filein2:
1111
4444
4444
4444
5555
Actual Output:
File1(matching records):
1111
File2(unmatched records from Filein1):
2222
3333
File3(unmatched records from Filein2):
4444
5555
Desired Output:
File1(matching records):
1111
File2(unmatched records from Filein1):
2222
2222
3333
File3(unmatched records from Filein2):
4444
4444
4444
5555
I have tried with all possible keywords like WITHALL, KEEPNODUPS but I am not getting desired result. Please help me in getting above result. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Tue Jul 05, 2011 8:57 pm Post subject: |
|
|
Suggest you consider JOINKEYS. . . rather than SPLICE. . . _________________ All the best,
di |
|
Back to top |
|
 |
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jul 06, 2011 10:56 am Post subject: |
|
|
psmadhusudhan,
As others mentioned, Joinkeys is the ideal solution for this. You also need to clarify what the output is when you have matching duplicate keys in both files
ex:
Code: |
//IN1 DD *
1111 - F1 KEY1
1111 - F1 KEY2
2222 - F1 KEY1
2222 - F1 KEY2
3333 - F1 KEY1
|
Code: |
//IN2 DD *
1111 - F2 KEY1
1111 - F2 KEY2
1111 - F2 KEY3
4444 - F2 KEY1
4444 - F2 KEY2
4444 - F2 KEY3
5555 - F2 KEY1
|
What is the expected output from the above? You have 2 duplicates for 1111 key in file 1 and 3 duplicates for 1111 key in file 2. What is the expected output in this case? Is it (2 X3 = 6 ) records for 1111 key? or just (2+3 =5) matching keys?
Also is the data already sorted on the key? _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Fri Jul 08, 2011 10:57 pm Post subject: |
|
|
Sorry for late reply. I have tried with joinkeys. But it seems I need two steps to get two unmatched files, can this be done in one single step.
Kolusu,
My requirement is only to get unmatched file, so even if there are duplicates in match keys it is not so important, only thing they should not come into output of unmatched files. My input is some times sorted and sometimes not sorted. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Sat Jul 09, 2011 11:58 am Post subject: |
|
|
psmadhusudhan wrote: | Sorry for late reply. I have tried with joinkeys. But it seems I need two steps to get two unmatched files, can this be done in one single step. |
You don't need 2 steps. answer the following questions
1. what is the lrecl and recfm of the both input files?
2. what is the lrecl and recfm of output files?
3. Show us a sample of your input and desired output with duplicates on both match and nonmatch keys. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|