View previous topic :: View next topic
|
Author |
Message |
srajanbose
New User
Joined: 11 Oct 2004 Posts: 69 Location: chennai
|
|
|
|
Hi,
I have an requirement as below.
The program reads an first input file and take the Key value from the record after that i need to verify in the second file whether the key is present or not.
I think this can be done using search and search all.But i heard its not optimised way. so anyone suggest some other way to acheive this requirement. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Hi Rajan,
Quote: |
The program reads an first input file and take the Key value from the record after that i need to verify in the second file whether the key is present or not. |
Can you give us this in a paragraph, with punctuation, so we don't have to guess at what you are saying (I've lost count of how many different meanings this sentence might have depending on punctuation). Then we can get to the second bit.
Often, what you "hear" is pretty worthless because if nothing else there is no context to it, so no way of knowing if it applies to your situation. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Several questions come immediately to mind:
1) Is the first (input) file a sequential file, or a VSAM KSDS file?
1a) If a sequential file, is it sorted on the "key value"? If not, why not?
1b) If a KSDS, is the "key value" leftmost in the file's key or alternate index?
2) Is the second (match) file a sequential file, or a VSAM KSDS file?
2a) If a sequential file, is it sorted on the "key value"? If not, why not?
2b) If a KSDS, is the "key value" leftmost in the file's key or alternate index?
3) Does this 'matching process' HAVE to be done in a COBOL program? (hint: it could be easily accomplished using a SORT product). |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
it looks like the classic transactions/master files relation...
the transaction file should be sorted on the master key...
then there are two choices ( depending on the transaction record count vs. master record count )
1) if the ratio is greater than about 30 % most probably the two file match approach might be faster
2) in a stationary state ...
read the transaction file and keep reading if the key is the same,
when the key changes issue a keyed read for the master,
that' s all |
|
Back to top |
|
|
|