Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Searching a record in a flat file using a key field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Searching a record in a flat file using a key field
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: 2150
Location: At my coffee table

PostPosted: Thu May 15, 2008 9:30 pm    Post subject:
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    Post subject:
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Thu May 15, 2008 10:14 pm    Post subject:
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

Site Director


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

PostPosted: Thu May 15, 2008 11:25 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us