Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8597
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 Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm
This topic is locked: you cannot edit posts or make replies. Need help how to pass the ESP variabl... Venkichaitu JCL & VSAM 12 Thu Nov 02, 2017 3:53 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us