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

Dynamic Read on a flat file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Jan 31, 2014 12:29 am
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jan 31, 2014 12:32 am
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Tue Feb 04, 2014 6:16 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top