Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help in Syncsort to compare two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 141
Location: Coimbatore

PostPosted: Tue Nov 17, 2009 6:20 pm    Post subject: Help in Syncsort to compare two files
Reply with quote

I have a job:
Code:
 
//STEP02   EXEC PGM=SYNCTOOL                         
//TOOLMSG   DD SYSOUT=*                             
//DFSMSG    DD SYSOUT=*                             
//SORTIN1      DD DSN=H1279AQ.WB.PMFFB.EXT,DISP=SHR 
//SORTIN2      DD DSN=H1279AQ.MIS.APT.FILE,DISP=SHR 
//OUT1     DD DSN=H1279BC.MIS.APT.FIL1,DISP=SHR     
//TOOLIN    DD *                                     
  SELECT FROM (SORTIN1) TO(OUT1)  ON(1,7,CH)  -
                           ALLDUPS                       
                       
   SELECT FROM(SORTIN2) TO(OUT1)    -   
                     ON(1,7,CH) ALLDUPS
//*

In this SORTIN1:
N010521N010521 Y00400 2009042420090424
N010531N010531 Y00400 2009042420090424
N010651N010651 Y01300 2009062520090625


in SORTIN2:
N01052103IR04/27/200906/01/201012/31/9999
N010521031R04/27/200906/01/201012/31/9999
N01053103IR04/27/200906/01/201012/31/9999
N010531031R04/27/200906/01/201012/31/9999
N010531033R04/27/200906/01/201012/31/9999
N01064103IR06/23/200906/01/201012/31/9999


My requirement is to compare SORTIN1 and SORTIN2 based on the first 7 bytes and if any record matches then the record present in SORTIN2(which is a matched record) should be moved to OUT1.
So in this case the OUT1 should be like,

N01052103IR04/27/200906/01/201012/31/9999
N010521031R04/27/200906/01/201012/31/9999
N01053103IR04/27/200906/01/201012/31/9999
N010531031R04/27/200906/01/201012/31/9999
N010531033R04/27/200906/01/201012/31/9999

But when I used the above jcl all the records in SORTIN2 came to OUT1. Could anybody help me how my sort card should look like??? icon_sad.gif
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Nov 17, 2009 6:26 pm    Post subject:
Reply with quote

I think that JOINKEYS might be something to investigate
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 141
Location: Coimbatore

PostPosted: Tue Nov 24, 2009 11:55 am    Post subject: Reply to: Help in Syncsort to compare two files
Reply with quote

Hi,

I got the output and here is the jcl i tried. icon_smile.gif Just thought of sharing it.

Code:
//H1279BCT JOB ('SORT'),MSGCLASS=O,NOTIFY=H1279BC     
//STEP02   EXEC PGM=SYNCSORT                         
//TOOLMSG   DD SYSOUT=*                               
//DFSMSG    DD SYSOUT=*                               
//SORTJNF1     DD DSN=H1279AQ.WB.PMFFB.EXT,DISP=SHR   
//SORTJNF2     DD DSN=H1279AQ.MIS.APT.FILE,DISP=SHR   
//***  THIS WILL GIVE UNMATCHED RECORDS  ***         
//SORTOUT      DD DSN=H1279BC.MIS.APT.FIL1,DISP=SHR   
//SYSPRINT DD SYSOUT=*                               
//SYSOUT   DD SYSOUT=*                               
//SYSIN     DD *                                     
  JOINKEYS FILE=F1,FIELDS=(1,7,A)                     
  JOINKEYS FILE=F2,FIELDS=(1,7,A)                     
  JOIN UNPAIRED,F2,ONLY                               
  SORT FIELDS=COPY                                   
/*                                                   
//STEP03   EXEC PGM=SYNCSORT                         
//TOOLMSG   DD SYSOUT=*                               
//DFSMSG    DD SYSOUT=*                               
//SORTJNF1     DD DSN=H1279BC.MIS.APT.FIL1,DISP=SHR   
//SORTJNF2     DD DSN=H1279AQ.MIS.APT.FILE,DISP=SHR   
//SORTOUT      DD DSN=H1279BC.MIS.APT.FIL2,DISP=SHR   
//SYSPRINT DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SYSIN     DD *                                       
  JOINKEYS FILE=F1,FIELDS=(1,7,A)                     
  JOINKEYS FILE=F2,FIELDS=(1,7,A)                     
  JOIN UNPAIRED,F2,ONLY                               
  SORT FIELDS=COPY                                     
/*                                                     
//*** THIS STEP TO REFORMAT AS OF EXISTING LAYOUT *** 
//STEP01 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN       DD DSN=H1279BC.MIS.APT.FIL2,DISP=SHR   
//SORTOUT      DD DSN=H1279BC.MIS.APT.FIL4,DISP=SHR   
//SYSIN DD *                                           
  SORT FIELDS=(1,02,CH,A)                                               
  OUTREC FIELDS=(1:8,3,4:42,9,13:11,1,14:51,1,25:18,4,29:12,2,31:15,2, -
                 33:28,4,37:22,2,39:25,2,41:38,4,45:32,2,47:35,2)       
/*                                                                     

Code'd


Thanks....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Nov 24, 2009 8:55 pm    Post subject: Reply to: Help in Syncsort to compare two files
Reply with quote

Good to hear it is working - thank you for sharing your solution icon_smile.gif

fyi - you solution has been "Code'd" to preserve alignment and improve readability. when you post code, jcl, data, etc, it is best to use the Code tag. There is a Preview to let you see your post as it will appear to the forum rather than how it looks in the Reply Editor.

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us