Virtual Storage Access Method
| Company type | File storage access method |
|---|---|
| Industry | Computer software / Data storage |
| Founded | 1970s |
| Headquarters | United States |
| Products | Key-sequenced data set (KSDS), Relative record data set (RRDS), Entry-sequenced data set (ESDS), Linear data set (LDS) |
| Parent | IBM |
Virtual Storage Access Method (VSAM) is an IBM file storage access method designed for direct-access storage devices (DASD), initially released with the OS/VS1, OS/VS2 Release 1 (SVS), and MVS Release 2 operating systems. It continues to play a crucial role within the Multiple Virtual Storage (MVS) framework and contemporary z/OS systems. Originally developed as a record-centric filesystem, VSAM accommodates four types of data set organizations: key-sequenced (KSDS), relative record (RRDS), entry-sequenced (ESDS), and linear (LDS). Among these, KSDS, RRDS, and ESDS contain structured records, whereas LDS holds pages without inherent record formatting, making it suitable for memory-mapped file operations.
Overview
In IBM terminology, a data set corresponds to what is commonly known as a file, while direct-access storage device (DASD) refers to storage hardware capable of random access—such as disk drives—in contrast to sequential devices like tape drives.
VSAM organizes records that can be either fixed or variable in length into fixed-size blocks named control intervals (CIs), typically measured in bytes (for example, 4 kilobytes). These control intervals are aggregated into larger units called Control Areas (CAs), which are measured in terms of disk tracks or cylinders. Control Intervals function as the fundamental transfer units between the disk and the system memory, whereas Control Areas define the allocation granularity; VSAM datasets allocate storage in whole numbers of Control Areas.
The Access Method Services utility program IDCAMS is commonly employed for tasks such as defining and deleting VSAM datasets. VSAM data sets can be accessed through Job Control Language (JCL) DD statements, dynamic allocation processes, or interactive environments like Customer Information Control System.
Importantly, major IBM database systems such as IMS/DB and Db2 are built on top of VSAM, utilizing its underlying data structures to manage storage efficiently.
Files
The physical layout of VSAM data sets exhibits distinct characteristics compared to other access methods.
A typical VSAM file comprises multiple components; for instance, a KSDS includes both DATA and INDEX components.
Control intervals and control areas
Each VSAM component consists of fixed-length physical blocks organized into control intervals (CIs) and further grouped into control areas (CAs). The sizes of these units are determined by Access Method Services (AMS) and generally remain transparent to end users. A control area contains a predetermined number of control intervals.
Within a control interval, several records are stored sequentially starting from the lower address upwards, while control information is maintained from the higher address downwards. The space separating these two regions represents free space. This control information includes a mandatory control interval descriptor field (CIDF) alongside record descriptor fields (RDFs) that specify individual record lengths. Notably, free space within a CI is always maintained as a contiguous block.
When inserting new records, their sequence order is preserved by potentially shifting existing records within the CI. Deletions cause subsequent records to move downward to maintain contiguous free space. If the available free space is insufficient for an insertion, the control interval undergoes splitting: approximately half of its records remain in place while the remainder are transferred to a new CI allocated from a free pool within the same control area. Should no free CI be available within that CA, then the CA itself splits, distributing its control intervals evenly between two areas.
VSAM supports three file organizations oriented around records; note that linear data sets do not incorporate any record structure:
Sequential organization
An entry-sequenced data set (ESDS) maintains records in the exact sequence they are written. Accessing these records involves either a sequential scan or utilizing a relative byte address (RBA), which specifies the byte offset from the beginning of the file.
Records are retrieved without regard to their content, and their byte positions remain constant throughout the data set.
Even though ESDS does not include keys, it supports defining alternate indexes (AIXs) that provide key-based retrieval using specific fields. Each alternate index functions as a key-sequenced data set (KSDS) in its own right.
Indexed organization
A key-sequenced data set (KSDS) is a VSAM-supported data set characterized by records that each contain a unique key. The KSDS structure consists of two components: the data component storing the actual records and an index component that facilitates locating records via their keys. Together, these form a cluster.
Records within a KSDS can be accessed randomly or sequentially and may vary in length. Both data and index components are organized into control intervals and control areas. To preserve balanced distribution when inserting records at random positions, control intervals and areas may split dynamically.
While a primary KSDS includes one main key, additional fields can serve as secondary keys through alternate indices; each alternate index is itself implemented as a KSDS. The core data structure behind KSDS is a B+ tree, which enhances efficient searching and retrieval.
Relative organization
A relative record data set (RRDS) is a VSAM-supported data set where records are accessed by their ordinal sequence number, known as the relative record number (RRN). Unlike KSDS, RRDS does not use keys; instead, programs retrieve records based on their positional number.
Records in an RRDS are stored sequentially, allowing both random and sequential access by record position. This method offers simple positional retrieval without requiring indexing structures.
Linear organization
A linear data set (LDS) is a VSAM-supported data set with control interval sizes ranging from 4096 to 32768 bytes, increasing in increments of 4096 bytes. Unlike KSDS or RRDS, an LDS contains no embedded control information or discrete records within its structure.
Data addressing in an LDS utilizes Relative Byte Addressing (RBA), enabling systems such as IBM Db2 or the operating system itself to access data spread across multiple disk drives as one contiguous storage space. However, because LDS lacks defined record boundaries, it is less suitable for applications requiring structured record-level access.
Alternative approaches like Data In Virtual (DIV) and Window services provide mechanisms to interact with LDS using 4096-byte control intervals without direct reliance on VSAM interfaces.
Data access techniques
VSAM offers four primary methods for accessing data sets:
- Local Shared Resources (LSR), tailored for random or direct access patterns, frequently employed with CICS environments.
- Global Shared Resources (GSR), designed to enable VSAM data sets to be shared across multiple systems.
- Non-Shared Resources (NSR), optimized for sequential access and traditionally favored by batch processing applications.
- Distributed File Management (DFM), a server based on Distributed Data Management Architecture that facilitates remote creation, management, and usage of VSAM files.
Sharing data
VSAM Record-Level Sharing (RLS) facilitates data exchange among CICS regions by incorporating mechanisms for record caching and locking. Despite this, CICS retains responsibility for logging and commit operations, which restricts sharing capabilities beyond CICS environments.
To enable more extensive data sharing between CICS regions and batch processing jobs, Transactional VSAM (DFSMStvs) enhances VSAM RLS by integrating logging and two-phase commit functionality through z/OS services, thereby supporting comprehensive VSAM data sharing across diverse workloads.
History
VSAM was launched in the 1970s in conjunction with IBM's System/370 virtual storage operating systems such as DOS/VS, OS/VS1, and OS/VS2. It supplanted earlier access methods to deliver improved usability, enhanced performance, greater device independence, and to resolve performance degradation caused by virtual storage address translation in prior systems.
The KSDS data organization replaced the Indexed Sequential Access Method (ISAM), eliminating inefficiencies linked to fixed physical pointers embedded within the data structure. IBM ensured backward compatibility so that existing ISAM applications could operate seamlessly with KSDS.
The RRDS format succeeded the Basic Direct Access Method (BDAM), although the incentive to transition was less compelling since many BDAM datasets did not incorporate embedded pointers.
Subsequent advancements introduced Linear datasets, followed by VSAM RLS and Transactional VSAM, which collectively broadened VSAM’s role in managing enterprise-level data.
See also
- Job Control Language (JCL)
- IBM mainframe utility programs
- ISAM
- Geneva ERS
- Record Management Services, created by Digital Equipment Corporation
- Enscribe, developed by Tandem Computers
- Berkeley DB