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

How to Compare records in Two files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
itdsen

New User


Joined: 20 Sep 2006
Posts: 23
Location: Chennai

PostPosted: Tue Jun 17, 2008 5:05 pm
Reply with quote

I want to compare two files records and matched records should be written into file1 and un matched records into file2.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Tue Jun 17, 2008 5:17 pm
Reply with quote

itdsen,

This has been discussed many times. Search the forum with the Keyowrd "SELECT".

If you want a working JCL do post few more details on your requirement. l You want the entire record to be compared or specific bytes alone?
Back to top
View user's profile Send private message
itdsen

New User


Joined: 20 Sep 2006
Posts: 23
Location: Chennai

PostPosted: Tue Jun 17, 2008 6:12 pm
Reply with quote

input file 2 contain duplicate. so i want count no of records matched and count no of times matched .


eg
input file 1

121
100
123
124
156


input file 2.

121
123
121
121
121
156
156


output file
no of times matched
121 4
123 1
156 2


count no of rec matched : 3
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 17, 2008 10:32 pm
Reply with quote

itdsen,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN1      DD *                                             
121                                                         
100                                                         
123                                                         
124                                                         
156                                                         
//IN2      DD *                                             
121                                                         
123                                                         
121                                                         
121                                                         
121                                                         
156                                                         
156                                                         
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//T2       DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  COPY FROM(IN1) USING(CTL1)                                 
  COPY FROM(IN2) USING(CTL2)                                 
  SPLICE FROM(T1) TO(T2) ON(1,3,CH) KEEPNODUPS -             
  WITHALL WITH(01,80) WITH(85,1) USING(CTL3)                 
  COPY FROM(T2) USING(CTL4)                                 
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,BUILD=(1,3,81:1,3,C'11')                 
//CTL2CNTL DD *                                             
  OUTFIL FNAMES=T1,OVERLAY=(81:3X,C'22')                     
//CTL3CNTL DD *                                             
  OUTFIL FNAMES=T2,INCLUDE=(84,2,CH,EQ,C'12'),               
  REMOVECC,NODETAIL,BUILD=(1,80),                           
  SECTIONS=(81,3,                                           
  TRAILER3=(1,3,COUNT))                                     
//CTL4CNTL DD *                                             
  OUTFIL FNAMES=OUT,REMOVECC,                               
  TRAILER1=('COUNT NO OF REC MATCHED : ',COUNT)             
/*


Hope this helps...
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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 Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top