3 Top VSAM File Access Modes

Here’s all about access modes in VSAM file. Those are sequential, random and dynamic reads. When to use , in COBOL’ explained in this article.

VSAM File Access Modes

Sequential read

Only sequentially you can read. First you need to give START command to establish a key. Then READ NEXT to get next record and so on.

START file-name 
KEY IS EQUAL TO ALTERNATE-RECORD-KEY

Random read

You can go to any key either forward way or backward way.

Dynamic read

  • You can read a record Sequentially and also you can read random record. When a direct READ is performed for a VSAM indexed file, based on an alternate index for which duplicates exist, only the first record in the data set (base cluster) with that alternate key value is retrieved.
  • You need a series of READ NEXT statements to retrieve each of the data set records with the same alternate key.

File status codes

A file status code of 02 is returned if there are more records with the same alternate key value to be read; a code of 00 is returned when the last record with that key value has been read.

Also read

Discover more from Srinimf

Subscribe now to keep reading and get access to the full archive.

Continue reading