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: 6966
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: 1609
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
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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