View previous topic :: View next topic
|
Author |
Message |
rdhupad Currently Banned New User
Joined: 06 May 2009 Posts: 4 Location: Pune
|
|
|
|
Hi all,
I would like to find out the unmatched data from below given data. Please let me know the correct logic regarding this.I would like to take the data of two variables for matching purpose.
FILE 1 FILE 2
A A1 B B1
10 1 11 1
11 2 10 1
11 3 11 2
12 4 11 3
13 2 13 2
The logic should be like this way:--
1] File 1 is having data and one by one record of (A and A1) should check with every record(B and B1) of File 2 and if match record found then no action and if match record not found then this will be the output.
Appreciated much for valuable suggestions.
Thanks |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Sort file 1 and file 2. You then have a simple 2-way file merge process and there's code already posted to do this.
The WORST possible approach would be to read a record from file 1, open ifle 2 and read it until EOF or a match, close it, ....
This is extremely time-consuming, wasteful of resources, and not a good approach at all! |
|
Back to top |
|
|
rdhupad Currently Banned New User
Joined: 06 May 2009 Posts: 4 Location: Pune
|
|
|
|
Thanks for this reply.
Can you please let me know where is thie sorted code available |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Go to Mainframe COBOL part of the Forum, there is a sticky "2-File Match/Merge sample code ". Start from that. |
|
Back to top |
|
|
|