View previous topic :: :: View next topic
Author
Message
eytellene New User Joined: 19 May 2009Posts: 16 Location: Philippines
Hi Experts,
Is it possible for syncsort to get the number of records of the same key, and output the record key and its record count.
Thanks
Back to top
enrico-sorichetti Global Moderator Joined: 14 Mar 2007Posts: 10457 Location: italy
yes
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 500 Location: USA
eytellene ,
What is the position and length of your key field(s)?
Is the data set fixed or variable?
Back to top
eytellene New User Joined: 19 May 2009Posts: 16 Location: Philippines
Hi Alissa,
The datasets are fixed.
Input 1: file length 90, key 1 is in position 1, 12 bytes. key 2 is position 13, integer
11111111111112
22222222222210
33333333333322
Input 2: file length 50, key 1 is in position 1,12 bytes; key 2 position 13,integer
11111111111112
11111111111112
11111111111112
22222222222210
22222222222210
33333333333322
Output must be file length, 30 ,key 1 position 1,12 bytes,key 2 position 13, integer;number of records in file 2 with the same key 1 and 2 in file 1 position 15
1111111111111203
2222222222211002
3333333333332201
Thanks in advance
Back to top
Alissa Margulies SYNCSORT Support Joined: 25 Jul 2007Posts: 500 Location: USA
Here is a SyncSort for z/OS job that will do what you asked:
Code:
//STEP1 EXEC PGM=SORT
//SORTJNF1 DD DSN=INPUT1 (FB/90)
//SORTJNF2 DD DSN=INPUT2 (FB/50)
//SORTOUT DD DSN=OUTPUT (FB/30)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,12,A,13,2,A)
JOINKEYS FILES=F2,FIELDS=(1,12,A,13,2,A)
REFORMAT FIELDS=(F1:1,14)
SORT FIELDS=COPY
OUTREC OVERLAY=(15:SEQNUM,2,ZD,RESTART=(1,14),30:X)
OUTFIL SECTIONS=(1,14,
TRAILER3=(1,30)),
REMOVECC,NODETAIL
/*
Back to top
eytellene New User Joined: 19 May 2009Posts: 16 Location: Philippines
Hi Alissa,
Thanks a lot
It worked .....!!!!!!
Back to top
Please enable JavaScript!