Page 1 of 1

compare & move datas in file 1 to file 2 using syncsort?

PostPosted: Mon Dec 20, 2010 7:47 pm
by maandi
Hi,

Using sync sort is it possible to move certain fields from one file to another file after comparing.

Scenario:

File 1:
E12345678902009
A23345677782010
d57676868792011

sync sort parameter file:
2010 (varies as per previous calculations)


My expected output file should be: A23345677782010


It should compare the field "year" (i.e 2010) in input file to the year "2010" in the parm file and retrieve the entire record of 2010...

Please let me know if its possible using Sync sort?

Thanks,
Maandy.

Re: compare & move datas in file 1 to file 2 using syncsort?

PostPosted: Tue Dec 21, 2010 12:34 am
by Alissa Margulies
Hello Maandy.

Here is a SyncSort for z/OS job that will do what you asked:
//STEP1 EXEC PGM=SORT             
//SORTJNF1 DD *                   
E12345678902009                   
A23345677782010                   
D57676868792011                   
//SORTJNF2 DD *                   
2010                               
//SORTOUT DD SYSOUT=*             
//SYSOUT  DD SYSOUT=*               
//SYSIN   DD *                       
  JOINKEYS FILES=F1,FIELDS=(12,4,A)
  JOINKEYS FILES=F2,FIELDS=(1,4,A)
  REFORMAT FIELDS=(F1:1,80)       
  SORT FIELDS=COPY                 
/*                                 


Regards,

Re: compare & move datas in file 1 to file 2 using syncsort?

PostPosted: Tue Dec 21, 2010 1:02 pm
by maandi
Hi Alissa,

It worked out well ... thanks a lot...
Could you explain how this JOINKEYS work...?


Thanks,
Maandy

Re: compare & move datas in file 1 to file 2 using syncsort?

PostPosted: Tue Dec 21, 2010 9:38 pm
by Alissa Margulies
The JOINKEYS control statement is used to enable join feature processing and to identify the fields used to select records for join processing. The join feature joins records from two input files that are specified on the SORTJNF1 and SORTJNF2 DD statements. For complete details regarding SyncSort's join processing, please refer to the SyncSort for z/OS 1.3 Programmer's Guide.