Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us