IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

A question on search and writing matched and unmatched rec.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Mon Jan 25, 2010 10:41 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 25, 2010 11:00 am
Reply with quote

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
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Mon Jan 25, 2010 11:26 am
Reply with quote

Sure DS.
Back to top
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Mon Jan 25, 2010 11:32 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jan 25, 2010 11:39 am
Reply with quote

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
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Mon Jan 25, 2010 11:45 am
Reply with quote

Fine enrico.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 25, 2010 8:30 pm
Reply with quote

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
View user's profile Send private message
Mukesh Pandey

Active User


Joined: 11 Nov 2008
Posts: 143
Location: India

PostPosted: Wed Jan 27, 2010 9:54 am
Reply with quote

Thank you DS.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jan 27, 2010 10:51 am
Reply with quote

You're welcome - good luck icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Two input files & writing counter... DFSORT/ICETOOL 12
No new posts Question for file manager IBM Tools 7
Search our Forums:

Back to Top