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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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