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
 
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: 2504
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: 1788
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 Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

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