Comapre & Sort with duplicates
Posted: Wed Sep 25, 2013 12:23 pm
Hi,
I have two GDG generations.Each contains some set of user ids.
Pls See below for details.
Note:There are no keys present other than the user id i.e no other info in the datasets except user ids
What I need is unpaired user ids present in GDG-1 alone with duplicates.
i.e as per the below info in fig-1, CCCC,DDDD,SSSS is present only in GDG-1 so I get that in the output
but AAAA is present twice in GDG-1 and only once in GDG-2 hence I need AAAA once in the ouput dataset along with (CCCC,DDDD,SSSS) but am unable to achieve it.
I used Join keys in SORT PGM
JOIN KEYS F1=(12,4,A)
JOIN KEYS F2=(22,4,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1,1:80)
(Please forgive for syntax errors)
Fig-1
GDG-1(data in cols 12-15)
-------------------------------------
AAAA
BBBB
CCCC
DDDD
AAAA
SSSS
GDG-2 (data in cols 22-25)
-------------------------------------
AAAA
BBBB
EEEE
SSSS
Output GDG what I Need
------------------------------------
AAAA
CCCC
DDDD
SSSS
But what I actually get by using join keys is below
Output GDG what I get using JOIN keys
---------------------------------------
CCCC
DDDD
SSSS
I tried using join keys also please let me know if you have any other approach.
I have a very minimal experience in coding..but still I tried to a extent.Unfortunately couldn't able to achieve the results.
Looking forward for some help.Thank you.
I have two GDG generations.Each contains some set of user ids.
Pls See below for details.
Note:There are no keys present other than the user id i.e no other info in the datasets except user ids
What I need is unpaired user ids present in GDG-1 alone with duplicates.
i.e as per the below info in fig-1, CCCC,DDDD,SSSS is present only in GDG-1 so I get that in the output
but AAAA is present twice in GDG-1 and only once in GDG-2 hence I need AAAA once in the ouput dataset along with (CCCC,DDDD,SSSS) but am unable to achieve it.
I used Join keys in SORT PGM
JOIN KEYS F1=(12,4,A)
JOIN KEYS F2=(22,4,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1,1:80)
(Please forgive for syntax errors)
Fig-1
GDG-1(data in cols 12-15)
-------------------------------------
AAAA
BBBB
CCCC
DDDD
AAAA
SSSS
GDG-2 (data in cols 22-25)
-------------------------------------
AAAA
BBBB
EEEE
SSSS
Output GDG what I Need
------------------------------------
AAAA
CCCC
DDDD
SSSS
But what I actually get by using join keys is below
Output GDG what I get using JOIN keys
---------------------------------------
CCCC
DDDD
SSSS
I tried using join keys also please let me know if you have any other approach.
I have a very minimal experience in coding..but still I tried to a extent.Unfortunately couldn't able to achieve the results.
Looking forward for some help.Thank you.