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
 

 

Search in flat file depending upon a specific field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Search in flat file depending upon a specific field
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu Jun 07, 2007 2:47 pm    Post subject:
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

Site Director


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

PostPosted: Fri Jun 08, 2007 12:24 am    Post subject:
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    Post subject:
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    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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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