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

Compare two files in JCL


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

New User


Joined: 11 Nov 2010
Posts: 21
Location: India

PostPosted: Thu Aug 25, 2011 5:24 pm
Reply with quote

Hi,

I have a situation here.

File1 is of 179 bytes length. File2 is of 10 bytes length.

Now, these 2 files needs to be compared (length 17:10 of File1 with Lenght 1:10 of File2) and the unmatched records of File1 shoule be sent to output. Nomatter there are duplicates in File1:

For Example:

FILE1:
------
XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567891XXXXXX
XXXXXXXXXXXXXXXX1234567892XXXXXX
XXXXXXXXXXXXXXXX1234567893XXXXXX
XXXXXXXXXXXXXXXX1234567894XXXXXX

FILE2:
------
1234567891
1234567892
1234567893

Expected O/P
------------
XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567894XXXXXX

How can be this done in JCL?

Thank you for your help.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 5:32 pm
Reply with quote

Below DFSORT step will give you desired result
Code:

//STEP0200 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//FILE1    DD *                             
XXXXXXXXXXXXXXXX1234567890XXXXXX             
XXXXXXXXXXXXXXXX1234567890XXXXXX             
XXXXXXXXXXXXXXXX1234567891XXXXXX             
XXXXXXXXXXXXXXXX1234567892XXXXXX             
XXXXXXXXXXXXXXXX1234567893XXXXXX             
XXXXXXXXXXXXXXXX1234567894XXXXXX             
//FILE2    DD *                             
1234567891                                   
1234567892                                   
1234567893                                   
//SORTOUT  DD SYSOUT=*                       
//SYSIN DD *                                 
  SORT FIELDS=COPY                           
  JOINKEYS F1=FILE1,FIELDS=(17,10,A),SORTED 
  JOINKEYS F2=FILE2,FIELDS=(1,10,A),SORTED   
  JOIN UNPAIRED,F1,ONLY                     
  REFORMAT FIELDS=(F1:1,179)                 


Output will be
Code:

XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567890XXXXXX
XXXXXXXXXXXXXXXX1234567894XXXXXX
Back to top
View user's profile Send private message
dharani.nagarajan

New User


Joined: 11 Nov 2010
Posts: 21
Location: India

PostPosted: Thu Aug 25, 2011 5:53 pm
Reply with quote

@ Escapa

Thank you So much. Its working fine now.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 6:25 pm
Reply with quote

dharani.nagarajan wrote:
@ Escapa

Thank you So much. Its working fine now.

Nice to hear back..
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 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
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top