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

Search in flat file depending upon a specific field


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

New User


Joined: 01 Jun 2007
Posts: 3
Location: UK

PostPosted: Thu Jun 07, 2007 1:50 pm
Reply with quote

Hi all,

Can you please tell me whether a search is possible in sequential depending upon a specific field?
For eg I have field 'account num' I need to search a flat file for this field and after this field is found, then find matching record in 2nd file and write corresponding record to another file.
Please let me know how this functionality can be implemented usign cobol pgm?
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Thu Jun 07, 2007 2:25 pm
Reply with quote

Hi Nagajyothi,

I understood that U have 3 files.

First : Here we need to search the occurance of the Account Number.

Second: If it exists then find the existance of the record with the same Account number in this file.

Third: If it exists in the second file then process that record and then write it into the third file.


I hope this is ur requirement.


Follow these steps

Step1: To search the occurance of the Account number in the Flat file then read the recods in the file sequentially and until u find the account number or End-of-file is reached.

Step2: If u find the Accoun Number then follow the same procedure in for the second file and get the matched record from the second file.

Step3: Process the record and then write into the Third file.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Jun 07, 2007 2:47 pm
Reply with quote

Or you could use DFSORT which is good for things like that.
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: Fri Jun 08, 2007 12:24 am
Reply with quote

Hello,

How many different account numbers will be processed in a single execution?

The answer to that may determine which approach you use. There are multiple ways to do what you posted (if i understood the requirement correctly).
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Fri Jun 08, 2007 11:55 am
Reply with quote

Hello,

You can implement mkk157 pseudocode but sort first and second files first so that everything can be done in 1 pass and to make everything more efficient.


Regards.
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