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
 

 

Dynamic Read on a flat file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Fri Jan 31, 2014 12:25 am    Post subject: Dynamic Read on a flat file
Reply with quote

Once the flat file has read the record and if I want to go back to again read the same record, how can I do it in cobol
for e.g: If there are 10 records in a flat file, I have read 5th record and again i need to start the read from 3rd record, the record numbers will be dynamic not fixed.
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 Jan 31, 2014 12:29 am    Post subject:
Reply with quote

Hello,

You cannot do this directly in COBOL. Why does someone believe this is needed?

Can the values that need to be re-processed be placed in an array for recall?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 31, 2014 12:32 am    Post subject: Reply to: Read logic
Reply with quote

REPRO the file to a VSAM/KSDS Cluster, specifying ACCESS IS DYNAMIC in the COBOL program and restart at this same key by specifying START "File-Name" KEY NOT LESS THAN "Key-Value".
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Jan 31, 2014 6:47 pm    Post subject:
Reply with quote

I applaud Bill for his excellent solution to a problem,
that I agree with Dick,
is actually a non-problem.
why would anyone creat logic that required re-reading of a record?

my obvious disparagement of the problem should not lead to anyone
disregarding Bill's suggestion.

Often a flat file is used and contorted logic is required for processing.
Implementing Bill's suggestion would provide a means to make the processing logic easier.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1736
Location: NY,USA

PostPosted: Tue Feb 04, 2014 6:16 am    Post subject:
Reply with quote

You basically only can perform a sequential read on flat file,so above two solutions are the only options to your qustion. If the volume of data is huge then using a KSDS would be advisied otherwise an array would do it.
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
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
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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