Logic using joinkeys sort



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

Logic using joinkeys sort

Postby jvinoth » Tue May 28, 2013 3:24 pm

Hi,

Can anyone suggest me can we do do the below logic using joinkeys sort.

I have two files.

File 1:
-------
Length:60 FB

EX:

1111111222222212375678911AAAAA    BBBBBB           AABB1000
1111111222222212375678911AAAAA    BBBBBB           AABB1000
1111111222222212375678912AAAAA    BBBBBB           AABB1000
1111111222222212375678914AAAAA    BBBBBB           AABB1000


FILE 2:
------
Length:87 FB

EX:

14972709912375678911014.980ISAACS                        KENNETH
57986877891023469889012.700HALL                          LAJUAN
21717631812375678914021.240BISCH                         ANDRE 
57553704391023476689019.100CABANA                        BOWMAN



EXPECTED OUPUT FILE 1:
----------------------

1111111|2222222|AABB1000|ISAACS|12375678911
1111111|2222222|AABB1000|BISCH |12375678914


EXPECTED OUTPUT FILE 2:
-----------------------

1111111|2222222|12375678911|AABB1000|014.980
1111111|2222222|12375678914|AABB1000|021.240


Key comparing in both files are 12375678911,12375678914(file 1--position (15,11) & file 2 --(10,11))

if the keys matched in both records then need to write two files with some records from file 1 & file 2.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: JOINKEYS

Postby dick scherrer » Tue May 28, 2013 11:56 pm

Hello,

Suggest you use the Code tag when posting this kind of info.

You might have gotten replies sooner.

What have you done so far? Post your sort control and JCL.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: JOINKEYS

Postby jvinoth » Wed May 29, 2013 11:08 am

Thanks Dick,

I need to know whether we can use the two reformats in a single sort card.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: JOINKEYS

Postby bodatrinadh » Wed May 29, 2013 5:11 pm

Hi Vinoth,

Can anyone suggest me can we do do the below logic using joinkeys sort.


Your task can be acheived in Joinkeys...

I need to know whether we can use the two reformats in a single sort card.


No. Sort won't allow TWO reformats in a single sort card.
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: JOINKEYS

Postby jvinoth » Wed May 29, 2013 6:38 pm

thanks,

So how can we create two files with the needed information from the file1 & file2. I think we can do this by using the reformat please correct me if I am wrong.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: JOINKEYS

Postby dick scherrer » Wed May 29, 2013 7:36 pm

Hello,

Consider using two OUTFIL FNAMES and BUILD statements. You can create multiple output files in one step.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: JOINKEYS

Postby jvinoth » Thu May 30, 2013 5:29 pm

Thanks Dick,

can you please provide sample code if possible.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: JOINKEYS

Postby jvinoth » Thu May 30, 2013 5:32 pm

SORT FIELDS=COPY
JOINKEYS FILES=F1,FIELDS=(14,11,A)
JOINKEYS FILES=F2,FIELDS=(10,11,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(
OUTFIL FILES=01,INCLUDE=(
OUTFIL FILES=02,INCLUDE=(

can tell me how to use the reformat in this case because i need to output files which has the records from file1 & file2.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: JOINKEYS

Postby bodatrinadh » Thu May 30, 2013 10:20 pm

Vinoth,

Try this code


//STEP01   EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SYSPRINT DD SYSOUT=*                                           
//SORTJNF1 DD *                                                 
1111111222222212375678911AAAAA    BBBBBB           AABB1000     
1111111222222212375678911AAAAA    BBBBBB           AABB1000     
1111111222222212375678912AAAAA    BBBBBB           AABB1000     
1111111222222212375678914AAAAA    BBBBBB           AABB1000     
//SORTJNF2 DD *                                                 
14972709912375678911014.980ISAACS                        KENNETH
57986877891023469889012.700HALL                          LAJUAN 
21717631812375678914021.240BISCH                         ANDRE   
57553704391023476689019.100CABANA                        BOWMAN 
//OUTPUT1  DD SYSOUT=*                                           
//OUTPUT2  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
  JOINKEYS FILE=F1,FIELDS=(15,11,A)                             
  JOINKEYS FILE=F2,FIELDS=(10,11,A)                             
  REFORMAT FIELDS=(F1:1,80,F2:1,80)                             
  SORT FIELDS=(1,80,CH,A)                                       
  SUM FIELDS=NONE                                                     
  OUTFIL FNAMES=OUTPUT1,BUILD=(1,7,C'|',8,7,C'|',52,08,C'|',108,6,C'|',
                             15,11)                                 
  OUTFIL FNAMES=OUTPUT2,BUILD=(1,7,C'|',8,7,C'|',15,11,C'|',52,8,C'|',
                            101,7)                                   
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Re: JOINKEYS

Postby bodatrinadh » Thu May 30, 2013 10:40 pm

Vinoth,

I didn't notice the input file attributes.Pls change according to your requirement.
Thanks
-3nadh
User avatar
bodatrinadh
 
Posts: 67
Joined: Thu Jan 12, 2012 9:05 pm
Has thanked: 0 time
Been thanked: 4 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post