Introduction to VSAM
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. Although there are still datasets that are best managed with the several other (non-VSAM) data management methods, VSAM is a major component of modern IBM operating systems.
A D V E R T I S E M E N T
Virtual storage access method (VSAM) is an IBM disk file storage access method, first used in the OS/VS2 operating system, later used throughout the Multiple Virtual Storage (MVS) architecture and now in z/OS. Originally a record-oriented filesystem, VSAM comprises four data set organizations: Key Sequenced Data Set (KSDS), Relative Record Data Set (RRDS), Entry Sequenced Data Set (ESDS) and Linear Data Set (LDS). The KSDS, RRDS and ESDS organizations contain records, while the LDS organization (added later to VSAM) simply contains a sequence of bytes with no intrinsic record structure.
IBM uses the term data set in official documentation as a synonym of file, and DASD instead of disk drive.
VSAM records can be of fixed or variable length. They are organised in fixed-size blocks called Control Intervals (CIs), and then into larger divisions called Control Areas (CAs). Control Interval sizes are measured in bytes — for example 4 kilobytes — while Control Area sizes are measured in disk tracks or cylinders. Control Intervals are the units of transfer between disk and computer so a read request will read one complete Control Interval. Control Areas are the units of allocation so, when a VSAM data set is defined, an integral number of Control Areas will be allocated.
The Access Method Services utility program IDCAMS is commonly used to manipulate ("delete and define") VSAM data sets.
Custom programs can access VSAM datasets through data definitions (DDs) in Job Control Language (JCL) or in online regions such as in Customer Information Control Systems (CICS).
Both IMS/DB and DB2 are implemented on top of VSAM and use its underlying data structures.
Concepts and Facilities
VSAM was, by several accounts, intended to replace all of the earlier data management systems in use by IBM's operating systems. Conventional (non-VSAM) access methods generally provide only a single type of dataset organization. VSAM provides three:
- Key Sequenced Data Set (KSDS), where each record is identified for access by specifying its key value - a sequence of characters embedded in each data record which uniquely identify that record from all other records in the dataset. KSDS datasets are similar to Indexed Sequential Access Method (ISAM) datasets, with many of the same characteristics, but also having distinct advantages over ISAM.
- Entry Sequenced Data Set (ESDS), where each record is identified for access by specifying its physical location - the byte address of the first data byte of each record in relationship to the beginning of the dataset. ESDS datasets are similar to Basic Sequential Access Methid (BSAM) or Queued Sequential Access Method (QSAM) datasets.
- Relative Record Data Set (RRDS), where each record is identified for access by specifying its record number - the sequence number relative to the first record in the dataset. RRDS datasets are similar to Basic Direct Access Method (BDAM) datasets.
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.