z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Direct Retrieval

z/OS DFSMS Using Data Sets
SC23-6855-00

Records can also be retrieved directly using keyed access or addressed access.

Keyed Direct Retrieval. For a key-sequenced data set does not depend on prior positioning. VSAM searches the index from the highest level down to the sequence set to retrieve a record. Specify the record to be retrieved by supplying one of the following:
  • The exact key of the record
  • An approximate key, less than or equal to the key field of the record
  • A generic key

You can use an approximate specification when you do not know the exact key. If a record actually has the key specified, VSAM retrieves it. Otherwise, it retrieves the record with the next higher key. Generic key specification for direct processing causes VSAM to retrieve the first record having that generic key. If you want to retrieve all the records with the generic key, specify RPL OPTCD=NSP in your direct request. That causes VSAM to position itself at the next record in key sequence. Then retrieve the remaining records sequentially.

To use direct or skip-sequential access to process a fixed-length or variable-length RRDS, you must supply the relative record number of the record you want in the argument field of the RPL macro. For a variable-length RRDS, you also must supply the record length in the RECLEN field of the RPL macro. If you request a deleted record, the request causes a no-record-found logical error.

A fixed-length RRDS has no index. VSAM takes the number of the record to be retrieved and calculates the control interval that contains it and its position within the control interval.

Addressed Direct Retrieval. Requires the RBA of each individual record is specified; previous positioning is not applicable.

With direct processing, optionally specify RPL OPTCD=NSP to indicate the position is maintained following the GET. Your program can then process the following records sequentially in either a forward or backward direction.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014