IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help in Syncsort to compare two files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Tue Nov 17, 2009 6:20 pm
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: 8797
Location: Welsh Wales

PostPosted: Tue Nov 17, 2009 6:26 pm
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: 184
Location: Coimbatore

PostPosted: Tue Nov 24, 2009 11:55 am
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

Moderator Emeritus


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

PostPosted: Tue Nov 24, 2009 8:55 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top