Page 1 of 1

Read vsam file in reverse order?

Posted: Wed Feb 14, 2024 12:25 pm
by Bobbie V
Hi,

How do we read vsam file in reverse order? Is this possible, if yes please help.

Re: Read vsam file in reverse order?

Posted: Thu Feb 15, 2024 1:55 am
by Robert Sample
Generally, VSAM data sets (like sequential data sets) will be read sequentially from the first record to the last.  You can use direct reads instead of sequential reads to skip around in the data set.  

CICS does allow you to read in a reverse fashion by allowing EXEC CICS READPREV but this only applies to CICS.

Re: Read vsam file in reverse order?

Posted: Thu Feb 15, 2024 12:51 pm
by Bobbie V
Robert Sample" wrote: Thu Feb 15, 2024 1:55 am Generally, VSAM data sets (like sequential data sets) will be read sequentially from the first record to the last.  You can use direct reads instead of sequential reads to skip around in the data set.  

CICS does allow you to read in a reverse fashion by allowing EXEC CICS READPREV but this only applies to CICS.
 
This does not apply to normal COBOL Batch program, then how can we do this for batch? please guide.