Introduction
History
- There are several access methods that are developed to access the data from the files. VSAM is the most used and one of the several access methods using by OS of mainframe.
- VSAM is the short form of Virtual Storage Access Method. VSAM was introduced in the early 1970s by IBM with three dataset organizations - sequential, indexed, and direct access. It has been continuously improved and enhanced from 1970.
- The word Virtual specifies that it was developed when the initial IBM virtual storage operating systems OS/VS1 and OS/VS2 was introduced.
Access Methods and File Organization
Dataset types are classified based on the way of organizing the data on IBM disks. IBM software supports the below dataset types as of today -
- Physical Sequential (PS)
- Partitioned Organization (PO)
- Indexed Sequential (IS)
- Direct Access (DA)
- Virtual Storage Access Method (VSAM)
Each dataset type except VSAM has its own records organizing method depending on its purpose. However, VSAM provides a functional equivalent for most of the existing dataset types as follows -
- ESDS is the functional equivalent of Physical Sequential organization (PS).
- KSDS is the functional equivalent of Indexed Sequential organization (IS).
- RRDS is the functional equivalent of Direct Access organization (DA).
What is VSAM?
- Virtual Storage Access Method (VSAM) refers to both type of the dataset and the access methods that are used to manage various dataset types.
- An access method is a re-entrant code loaded and contained in DFSMSdfp (Data Facility Storage Management Subsystem dfp), a component of the z/OS DFSMS product. The access method makes an I/O operation (moving data between an I/O device and memory) easier for an application.
- VSAM is a type of record-oriented system and an IBM invented access method that allows us to access and organize records in the dataset.
- VSAM works with the data that stores only on direct access storage devices (DASDs). i.e., disks.
- VSAM files can't be displayed and edited by ISPF, and it requires a DITTO tool to get them displayed and edited in ISPF.
VSAM Dataset Types
VSAM record storage format is unique and not understandable by other access methods. Based on the VSAM storage format, accessing, and organizing the records, the datasets are classified into four different types, and those are -
- Entry-Sequenced Data Sets (ESDS)
- Key-Sequenced Data Sets (KSDS)
- Relative Record Data Sets (RRDS)
- Linear Data Sets (LDS)
The primary difference between these dataset types is - the way the records are stored and accessed.
VSAM Access and retrieval options
VSAM provides three types of record accessing -
- Sequential
- Direct
- Dynamic or Skip sequential
VSAM also provides the below access options -
- Two direct access modes - Addressed or Keyed
- Two access entities - Logical records or Control intervals
- Two access directions - Forward or Backward
- Retrieval options - Using generic key or Using key greater-than-or-equal
How VSAM is different from other datasets?
VSAM datasets differ from other dataset types for the below two reasons -
- VSAM datasets are device-independent.
- VSAM datasets can be both sequentially and directly accessed.
Advantages
- High-speed data retrieval when compared to other access methods because of its organized index.
- Supports all types of data retrieval (sequential, random, dynamic, linear).
- Supports fixed and variable-length records processing.
- Supports in batch and online systems.
- Inserting records is easy when compared to the other access methods.
- Records can be deleted physically and can reuse the deleted records space to store newly inserted records without reorganization. It helps for faster retrieving.
- Supports alternate index.
- Improves system efficiency.
- Reduce the data redundancy.
- Datasets can be physically distributed over multiple volumes based on key ranges.
- Independent of storage device types.
- VSAM datasets can be shared across systems and regions.
- A JCL requires a small amount of VSAM dataset information to process. But not detailed information because the VSAM dataset information is stored centrally (VSAM Catalog).
- The index is small hence uses less memory to store it. Because it uses a key compression algorithm.
- Provides data security with password protection of dataset at different levels (read, write, update, delete, etc.).
Disadvantages
- VSAM files data can't be accessed directly in ISPF, and it requires a tool to do the same.
- VSAM requires more DASD space.
- It only works with data stored on a DISK and can't handle data stored on other devices like tapes, etc.
- VSAM has minimal support for data sharing across regions.
- VSAM only provides security at the dataset level. If any changes are required to the security level, the user should handle them manually.