View previous topic :: View next topic
|
Author |
Message |
mangalrajnm
New User
Joined: 13 Apr 2007 Posts: 7 Location: Chennai
|
|
|
|
The requirement here is to compare a record based on a field from a flat file with its previous version of flat file for its existence. Lets say there are 1 million records in the previous version of that file. I feel sequential search won't be the efficient solution for this as we search the previous version only based on some condition and not at all time.Can any one suggest me a good solution from performance perspective. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Are the 'flat files' in the same key sequence?
Are the 'flat files' VSAM?
Have you looked into 'Join fields from two files on a key' in DFSort Smart Tricks? |
|
Back to top |
|
|
mangalrajnm
New User
Joined: 13 Apr 2007 Posts: 7 Location: Chennai
|
|
|
|
No the files are not in the same sequence.
They are flat files.
I need not join the fields after comparing but to write out the record in the third file using the contents of current file if the values other than the key mismatches with the previous version of current file |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If the files can not be sorted in the same sequence then just forget the whole process. If they can be sorted in the same sequence it becomes a relatively simple task. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
It is my understanding that the JOIN can be used to find mismatches and will sort the inputs, which with COBOL, you will need to do anyway...
There are several ways to identify mismatches using COBOL code, but without sorting (external or internal), it will be very inefficient..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
it will be very inefficient..... |
A big understatement. . . If you try to "match without sorting" 2 files of a million records each, it will probably never run to completion. 1,000,000,000,000 "reads" is just not going to be allowed to run.
If you want to use COBOL, sort the files into the key sequence. Download the 2-file match/merge sample code from the "Sticky" near the top of the COBOL section of the forum, review it, and post any questions here. As posted, that code will do very nearly exactly what you want to do. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi mangalrajnm,
Why don't you show us using 2 files with a few recs what you expect the results to be. Also tell us in detail, with examples, what this means:
Quote: |
.... as we search the previous version only based on some condition and not at all time. |
Then tell us how many matches you expect in the actual files. |
|
Back to top |
|
|
|