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

Searching a record in a flat file using a key field


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

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu May 15, 2008 9:15 pm
Reply with quote

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

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu May 15, 2008 9:30 pm
Reply with quote

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

New User


Joined: 13 Apr 2007
Posts: 7
Location: Chennai

PostPosted: Thu May 15, 2008 10:07 pm
Reply with quote

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

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu May 15, 2008 10:14 pm
Reply with quote

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

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu May 15, 2008 10:14 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu May 15, 2008 11:25 pm
Reply with quote

Hello,

Quote:
it will be very inefficient.....
A big understatement. . . icon_smile.gif 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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu May 15, 2008 11:58 pm
Reply with quote

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
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 and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top