Using VSAM Relative Record Data Set (RRDS) Files

How to:

The Adapter for VSAM supports both direct and sequential retrieval of fixed- and variable-length records from RRDS files, as well as modification of those records. RRDS files are VSAM files that are accessed through Relative Record Number keys (RRNs) and are processed in basically the same manner as key-sequenced (KSDS or KSEQ) VSAM files.

The RRN field that serves as the primary (unique) key for the segment follows all real fields in the physical root segment of the Master File and establishes the sequence for the records. The RRN field description must contain the following attributes:

ALIAS=RRN, USAGE=I10, ACTUAL=I4

Records in RRDS files are processed sequentially if the request does not provide a screening condition or join for the RRN-associated field.


Top of page

x
Syntax: How to Specify a Relative Record Number Field in a Master File
FILE=RRDSVSAM, SUFFIX=VSAM, DATASET=PGMYAN.RRDSVSAM.CLUSTER, $
SEGNAME=ROOT ,SEGTYPE=S0 ,$
FIELD=CODE , ,USAGE=A2 ,ACTUAL=A2 ,$
FIELD=NAME , ,USAGE=A10 ,ACTUAL=A10 ,$
FIELD=VALUE , ,USAGE=P2 ,ACTUAL=Z1 ,$
FIELD=ACCESS_KEY ,ALIAS=RRN ,USAGE=I10 ,ACTUAL=I4 ,$


Example: Applying Unique Keys With Records in RRDS Files

The following examples show how to view and apply unique Relative Record Number (RRN) key values when working with records in RRDS files.

Printing the records with their key values

TABLE FILE RRDSVSAM
PRINT CODE NAME VALUE ACCESS_KEY
END

Screening records by unique key values

TABLE FILE RRDSVSAM
PRINT CODE NAME VALUE ACCESS_KEY
IF ACCESS_KEY  GE 5
IF ACCESS_KEY  LE 15
END

Retrieving records by unique key values

TABLE FILE RRDSVSAM
PRINT CODE NAME VALUE ACCESS_KEY
IF ACCESS_KEY  EQ 5 OR 7 OR  9
END

Modifying records by unique key values

MODIFY FILE RRDSVSAM ECHO
FREEFORM ACCESS_KEY
MATCH ACCESS_KEY
ON NOMATCH COMPUTE CODE = 'A1';
ON NOMATCH COMPUTE NAME = 'RECORD 20';
ON NOMATCH INCLUDE 
ON MATCH REJECT
DATA
ACCESS_KEY=20
END

Updating matching records in RRDS files by unique key values

MODIFY FILE RRDSVSAM ECHO
FREEFORM ACCESS_KEY
MATCH ACCESS_KEY
ON NOMATCH REJECT
ON MATCH
TYPE "CODE: <D.CODE>, NAME: <D.NAME>, VALUE: <D.VALUE>";
ON MATCH COMPUTE VALUE = 9;
ON MATCH UPDATE VALUE
DATA
ACCESS_KEY=20
END

Deleting RRDS records based on unique key values

MODIFY FILE RRDSVSAM ECHO
FREEFORM ACCESS_KEY
MATCH ACCESS_KEY
ON NOMATCH REJECT
ON MATCH
TYPE "CODE: <D.CODE>, NAME: <D.NAME>, VALUE: <D.VALUE>";
ON MATCH DELETE
DATA
ACCESS_KEY=7
END

iWay Software