Comapre & Sort with duplicates



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Comapre & Sort with duplicates

Postby jags » 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.
jags
 
Posts: 6
Joined: Wed Sep 25, 2013 11:59 am
Has thanked: 3 times
Been thanked: 0 time

Re: Comapre & Sort with duplicates

 

Re: Comapre & Sort with duplicates

Postby BillyBoyo » Wed Sep 25, 2013 1:14 pm

You've not done badly. JOINKEYS is the correct way to go.

However, where you have JOIN UNPAIRED,F1,ONLY that means "only give me unmatched records from F1, nothing else".

JOIN UNPAIRED,F1 will give you matched records and unpaired F1 records.

Now you need to be a little clearer with your sample input and expected output. You need to show single match (one matching key on F1 and F2) multiple one-to-one match (two or more but same number for each key), single to multiple (one to two should be enough) and multiple to single (two to one). Then expected output for those.

Also can you include this temporarily in your step:

//JNF1CNTL DD *
INREC OVERLAY=(12:C'HI')


And post the full sysout from your step, inside the Code tags if possible (if you want to see how it works, click on the Quote button and look at the above two lines). This will help us determine which SORT product you have and its capabilities.

These users thanked the author BillyBoyo for the post:
jags (Wed Sep 25, 2013 4:50 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Comapre & Sort with duplicates

Postby jags » Wed Sep 25, 2013 3:51 pm

sorry it's not possible for me to post the sysout here
If you need my SORT product details, I see it as SYNCSORT for Z/os 1.4.1.0N

I need only unmatched records in GDG1 only (along with one instance of AAAA)

AAAA is present twice in GDG-1 whereas it is present only once in GDG2.
As per the code I have written what is happening is that its removing duplicates then trying to compare
and hence I am not getting the AAAA id which is present for the second time in GDG1.



Hope I made you clear
jags
 
Posts: 6
Joined: Wed Sep 25, 2013 11:59 am
Has thanked: 3 times
Been thanked: 0 time

Re: Comapre & Sort with duplicates

Postby Akatsukami » Wed Sep 25, 2013 4:49 pm

jags wrote:sorry it's not possible for me to post the sysout here

Why not?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Comapre & Sort with duplicates

Postby jags » Wed Sep 25, 2013 4:51 pm

I use a VM
jags
 
Posts: 6
Joined: Wed Sep 25, 2013 11:59 am
Has thanked: 3 times
Been thanked: 0 time

Re: Comapre & Sort with duplicates

Postby BillyBoyo » Wed Sep 25, 2013 4:52 pm

OK.

I don't know if JNFnCNTLs work for your SyncSort. You'll find out...

On JNF1CNTL and JNF2CNTL, specify the addition of a sequence number to each record, with a RESTART= for the correct key positions for the respective inputs.

Then add the position of the sequence numbers to the JOINKEYS key.

Where you have multiple AAAA they will no longer all match to the single AAAA.

These users thanked the author BillyBoyo for the post:
jags (Wed Sep 25, 2013 6:05 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Comapre & Sort with duplicates

Postby jags » Wed Sep 25, 2013 6:03 pm

I am not sure If I made any wrong.Below is what I coded and the output I got


Sort Step..
----------
SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(12,6,A)
JOINKEYS F2=IN2,FIELDS=(22,6,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FEILDS=(F1:1,80)
SORT FIELDS=COPY
/*
//JNF1CNTL DD *
INREC OVERLAY=(69:SEQNUM,3,ZD,RESTART=(12,6))
/*
//JNF2CNTL DD *
INREC OVERLAY=(69:SEQNUM,3,ZD,RESTART=(22,6))
/*


But the o/p i got is
--------------------

BBBB 001
AAAA 001
AAAA 001
AAAA 002
CCCC 001
CCCC 002


GDG-1 contained
---------------
BBBB
AAAA
AAAA
AAAA
CCCC
CCCC


GDG-2 Contained
---------------

BBBB
AAAA
AAAA
CCCC
jags
 
Posts: 6
Joined: Wed Sep 25, 2013 11:59 am
Has thanked: 3 times
Been thanked: 0 time

Re: Comapre & Sort with duplicates

Postby BillyBoyo » Wed Sep 25, 2013 6:52 pm

Your data isn't getting sorted. Why can't we see the sysout again?

You need to include the sequence number as a second part of the JOINKEYS key for each file.

Try adding SORT FIELDS=(with the joinkeys keys) into each of the JNFnCNTL files.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Comapre & Sort with duplicates

Postby jags » Wed Sep 25, 2013 8:58 pm

When I include - SORT fields=(12,6,A) & SORT fields=(22,6,A) in JNF1CNTL,JNF2CNTL statements
I get 'SORT statement - syntax error'. But I think am giving it right.Searched a lot but couldn't find anything.

Sysout with SORT statment in JNF1&2 says
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER486A ERROR IN JNF1 PROCESSING



Below is the sysout without SORT statment in JNF1&2

WER211B SYNCSMF CALLED BY SYNCSORT;RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B SORTOUT: EXCP'S=1,UNIT=....
WER416B TOTAL OF 1 EXCP'S ISSUED FOR COPYING
WER054I RCD IN 9, OUT 9
WER072I NOEQUALS, BALANCE IN EFFECT
WER482I JNF1 STATISTICS

DCB DETAILS
DSN NAME

WER483B G=116
WER484I IN1 : RCD IN=9,OMITTED=0,PAIRED=0,UNPAIRED=9
WER416B TOTAL OF 1 EXCP'S ISSUED FOR SORTING

SIMILARLY JNF2 STATS

Apologies for improper SYSOUT details..
jags
 
Posts: 6
Joined: Wed Sep 25, 2013 11:59 am
Has thanked: 3 times
Been thanked: 0 time

Re: Comapre & Sort with duplicates

Postby BillyBoyo » Wed Sep 25, 2013 9:23 pm

I've not used SyncSort with JOINKEYS. The way DFSORT works the SORT is automatic, on the keys. If you can't specify SORT in the JNFnCNTL, then it looks like SyncSort is the same.

So, why was the output you showed not SORTed? Plan B is that you don't have the correct start positions. You also have the RESTART on the same positions, and if you look at the output you showed the AAAA get number 1, 1, 2 and should have been 1, 2, 3.

Is your file an FB, or a VB? (I was hoping to see on the sysout).

//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(12,6,A,69,3,A)
  JOINKEYS F2=IN2,FIELDS=(22,6,A,69,3,A)
  JOIN UNPAIRED,F1,ONLY
  REFORMAT FEILDS=(F1:1,80)
  SORT FIELDS=COPY
/*
//JNF1CNTL DD *
  INREC OVERLAY=(69:SEQNUM,3,ZD,RESTART=(12,6))
/*
//JNF2CNTL DD *
  INREC OVERLAY=(69:SEQNUM,3,ZD,RESTART=(22,6))
/*


Try with that, and show the full input records, and the full output records. Check your start positions. Show the full sysout including all the message numbers please.

These users thanked the author BillyBoyo for the post:
jags (Wed Sep 25, 2013 10:27 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post