View previous topic :: View next topic
|
Author |
Message |
Mukesh Pandey
Active User
Joined: 11 Nov 2008 Posts: 143 Location: India
|
|
|
|
Hi all,
i have two files File1 that has 1 million records and File2 that has 10 thousand records.
Requirement : File3 shall contain matched records from File1 & File2.
File4 shall contain unmatched records from File1 & File2.
Since the records are in million please let me know the most optimized way to achieve this.
Thank you. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
First - both files need to be in the same key sequence. If they are not aleady in sequence, they need to be sorted.
Next - download the 2-file match/merge code from the "Sticky" near the top of the COBOL part of the forum.
Then, modify the sample code to meet your requirement. |
|
Back to top |
|
|
Mukesh Pandey
Active User
Joined: 11 Nov 2008 Posts: 143 Location: India
|
|
|
|
Sure DS. |
|
Back to top |
|
|
Mukesh Pandey
Active User
Joined: 11 Nov 2008 Posts: 143 Location: India
|
|
|
|
DS.. i saw the code..... let me please know whether this is the optimized way to for files having 1 Million records ?
Thank you. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
There is not much to optimize in a two file match program!
since You posted in the COBOL forum without telling anything more specific
You got a COBOL answer with a pointer to a generic two files match solution
certainly a <any sort product > solution will give better <performace wise> results
there are zillions samples around, just search the sort and jcl forums |
|
Back to top |
|
|
Mukesh Pandey
Active User
Joined: 11 Nov 2008 Posts: 143 Location: India
|
|
|
|
Fine enrico. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The posted sample code processes in the same amount of time as it takes to merely read the files. . . I use this for files with multiple hundred millioin records. . .
If the ONLY result needed is the simple match/merge, you might want to consider using the sort (as mentioned earlier). If there is additional business processing needed, you many want to consider adding this to the match/merge code saving multiple passes of the file(s) - which is where the time would be wasted. . .
Deciding which is the proper way to implement is not "fixed" - sometime the utility is better, sometime the code is better. |
|
Back to top |
|
|
Mukesh Pandey
Active User
Joined: 11 Nov 2008 Posts: 143 Location: India
|
|
|
|
Thank you DS. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
|