View previous topic :: View next topic
|
Author |
Message |
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3049 Location: NYC,USA
|
|
|
|
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 |
|
|
|