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
 

 

Compare two files in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compare two files in JCL
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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