VSAM Introduction
In this Mainframe tutorial, you will learn about VSAM, what is VSAM, VSAM structure, types of VSAM datasets, Entry Sequenced Data Set (ESDS), Key Sequenced Data Set (KSDS), Linear Data Set (LDS) and Relative Record Data Set (RRDS).
What is VSAM?
VSAM stands for Virtual Storage Access Method. The VSAM is a method used for managing files in mainframe system. That is in other words VSAM is a data management system used in mainframe systems and this was introduced by IBM. VSAM also known as Virtual Storage Access Method is an access method for IBM’s mainframe operating system – MVS.
VSAM Structure:
The management of data takes place as records in VSAM system and it is allowed for VSAM to be of any length as per the ends of user. The VSAM supports fixed as well as variable length records. These records are placed in blocks which are termed as Control Intervals and these Control Intervals are measured in bytes. The Control Intervals are further placed as Control Areas which is still of larger size.
Types of VSAM datasets:
The datasets of VSAM are generally referred as clusters and there are four types of VSAM datasets based on the way the records are stored and accessed which are given below:
• Entry Sequenced Data Set (ESDS)
• Key Sequenced Data Set (KSDS)
• Linear Data Set (LDS)
• Relative Record Data Set (RRDS)
Entry Sequenced Data Set (ESDS)
The Entry Sequenced Data Set is also called as ESDS and here each record is identified and accessed by specifying the physical location which in other words by specifying the byte address of the first data byte of each record in relationship to the beginning of the dataset. This method of VSAM helps to maintain records in sequential order. The ESDS cluster has one component viz. data component.
As we have seen before the records in ESDS datasets are accessed by specifying the physical location and so the records in ESDS cluster are stored in the order in which they are entered into the dataset maintaining their physical entry or location. The record is referenced by the relative byte address also termed as RBA. By this method it is not possible delete records but it is possible to add record and the new record added gets appended to the end of last dataset. Records in ESDS cluster may be fixed or variable length. Also accessing of records in ESDS can be done sequentially with the help of RBA value or randomly accessed to the desired record using the RBA value.
Key Sequenced Data Set (KSDS)
The Key Sequenced Data Set is also called as KSDS and is most commonly sued type of VSAM. In this method each record is located and accessed by specifying its key value. Key value is nothing but unique sequence of characters for each record that helps to access the record using this value. The KSDS cluster has two components in it.
• Index component
• Data component
As explained before key filed which is unique and same number of characters fir each record in data component of a KSDS cluster is placed. In the data component the actual records gets stored in logical sequence relative to their key field value. The list of key values for the records in the cluster along with pointers to the corresponding records in the data component is maintained in index component of the KSDS cluster. By pointer maintenance it is possible to reorganize records easily when new records are inserted or when records are deleted and also the records in KSDS cluster may be fixed or variable length. Also accessing of records in KSDS can be done sequentially with the help of key value or randomly accessed to the desired record using the key value.
Linear Data Set (LDS)
The Linear Data Set is also called as LDS and refers to a byte-stream dataset which is used rarely by users.
Relative Record Data Set (RRDS)
The Relative Record Data Set is also called as RRDS and here each record is identified and accessed by specifying the record number which is nothing but the sequence number relative to the first record in the dataset. Unlike ESDS the RRDS type of VSAM helps to access records in random order. The RRDS cluster has one component, the data component.
In contrast to the other two methods like KSDS and ESDS the RRDS supports only fixed length records. The record as specified before is accessed by using the record number which is any number from one to maximum number of records which may be contained in the dataset depending on the record position of slot number.
Both sequential and random Accessing of records in RRDS cluster is possible by using the relative record number of the desired record. In this method both addition of new records to the RRDS cluster is possible which writes the new record in the available empty slot and similarly deleting a record fro RRDS cluster is possible which gives room for empty slot.
From these methods VSAM helps to maintain disk records in a unique format. It is now important to learn where VSAM can be used and where not. VSAM in majority cases, is used in applications. One must clearly note that VSAM does not get applied in JCL or programs. Also it is not possible to edit VSAM files often using ISPF which is an interactive tool used in mainframes, we shall learn about ISPF in later sections of this Mainframe tutorial series.