Virtual Storage Access Method - VSAM - is a data management system introduced by IBM in the 1970s as part of the OS/VS1 and OS/VS2 operating systems. It is an access method used by most major mainframe systems to implement the different kinds of file organization techniques.
Types of VSAM Files
VSAM datasets are frequently referred to as clusters. A KSDS cluster consists of two physical parts, an index component, and a data component. ESDS and RRDS clusters consist of only a single component, the data component.
KSDS Cluster Components
Each record in the data component of a KSDS cluster contains a key field, which must be the same number of characters and occur in the same relative position in each record. The records are stored in the data component in logical sequence based upon their key field value. The index component of the KSDS cluster contains the list of key values for the records in the cluster with pointers to the corresponding records in the data component. The records in a KSDS may be accessed sequentially, in order by key value, or directly, by supplying the key value of the desired record. The records of a KSDS cluster may be fixed length or variable length. Records may be added or deleted at any point within a KSDS cluster, and the affected record is inserted or removed, and the surrounding records will be reorganized as required to maintain the correct logical sequence.
ESDS Cluster Components
The records in an ESDS cluster are stored in the order in which they are entered into the dataset. Each record is referenced by its relative byte address (RBA). In an ESDS dataset of 100 byte records, the RBA of the first record is 0, the RBA of the second record is 100, the RBA of the third record is 200, etc. The records in an ESDS may be accessed sequentially, in order by RBA value, or directly, by supplying the RBA of the desired record. The records of an ESDS cluster may be fixed length or variable length. Records may not be deleted from an ESDS cluster, and they may only be added (appended) to the end of the dataset, following records previously written.
RRDS Cluster Components
The records in an RRDS cluster are stored in fixed length slots. Each record is referenced by the number of its slot, which is a number varying from 1 to the maximum number of records, which may be contained in the dataset. The records in an RRDS cluster may be accessed sequentially, in relative record number order, or directly, by supplying the relative record number of the desired record. The records of an RRDS cluster must be of fixed length. Records may be added to an RRDS cluster by writing a new record's data into an empty slot, and records may be deleted from an RRDS cluster, thereby leaving an empty slot where the record that was deleted was previously stored.