Comparing two files with unmatching records written to file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Comparing two files with unmatching records written to file

Postby Praveen433 » Tue Jan 18, 2011 8:43 pm

Hi ,
Please help me in achieving the following criteria
There are two files with same record layout. The first two fields will act as a key(these two fields are common in both files), and the requirement is to compare the remaining fields of those two similar records. If any field is different then the output file should be written with the key fields followed by the mismatch field Number. The output file should contain records which have mismatch fields.

It looks like this
File 1:
                 1       2      3       4       5
Record 1: ABC   XYZ   SSS   AAA   BBB
Record 2: PQR   CBA   EEE  OOO   CCC
Record 3: EPF   ETR   UUU   JJJ   GGG

File 2:
                  1       2      3       4       5   
Record 1: ABC   XYZ    SSS   PPP   BBB
Record 2: PQR   CBA   EEE  OOO   CCC
Record 3: EPF   ETR   MMM   JJJ   QQQ



Output File:
Record 1: ABC   XYZ  4
Record 2: EPF   ETR  3  5


Any change in achieving the requirement is always welcome.
My main requirement is to get the field names which are not matching.
Praveen433
 
Posts: 3
Joined: Thu Dec 02, 2010 10:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Comparing two files with unmatching records written to file

 

Re: Comparing two files with unmatching records written to f

Postby NicC » Wed Jan 19, 2011 2:10 am

Q. Can either file have duplicates? If they can, then what is the criteria?

I sus pect that a sort product may have the ability to do what you want. Certainly you could use a programming language to do it. You CANNOT do it with JCL (although JCL could be used to present your solution to the machine for processing).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Comparing two files with unmatching records written to f

Postby dick scherrer » Wed Jan 19, 2011 2:16 am

Hello,

Which sort product is used on your system?

As NicC mentioned, this could easily be done with a bit of your own code.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post