The physical organization of VSAM data sets differs considerably from the organizations supported by other access methods, as follows. A VSAM file is defined as a cluster of VSAM components, e.g., for KSDS a DATA component and an INDEX component.
Control intervals and control areas VSAM components consist of fixed length physical blocks grouped into fixed length control intervals which means that accessing a particular record involves searching all the records
sequentially until it is located, or by using a
Relative byte address (RBA), i.e., the number of bytes from the beginning of the file to start reading. Records are loaded irrespective of their contents and their byte addresses cannot be changed. While an ESDS has no key, alternate indexes (AIXs) may be defined to permit the use of fields as keys. An alternate index is itself a KSDS.
Indexed organization A
key-sequenced data set (KSDS) is a type of
data set supported by VSAM. Each record in a KSDS data file is embedded with a unique key. A KSDS consists of two parts, the data component and a separate
index file known as the index component which allows the system to physically locate the record in the data file by its key value. Together, the data and index components are called a cluster. Records can be accessed randomly or in sequence and can be variable-length. As a
VSAM data set, the KSDS data and index components consist of control intervals which are further organized in control areas. As records are added at random to a KSDS, control intervals fill and need to be split into two new control intervals, each new control interval receiving roughly half of the records. Similarly, as the control intervals in a control area are used up, a control area will be split into two new control areas, each new control area receiving roughly half the control intervals. While a basic KSDS only has one key (the primary key), alternate indices may be defined to permit the use of additional fields as secondary keys. An alternate index is itself a KSDS. The data structure used by a KSDS is nowadays known as a
B+ tree.
Relative organization A
relative record data set (RRDS) is a type of
data set organization supported by VSAM. Records are accessed based on their ordinal position in the file (
relative record number, RRN). For example, the desired record to be accessed might be the 42nd record in the file out of 999 total. The concept of RRDS is similar to
sequential access method, but it can access with data in
random access and dynamic access. An RRDS consists of data records in sequence, with the record number indicating the record's logical position in the data set. A program can access records randomly using this positional number or access records sequentially. But unlike a
Key Sequenced Data Set, an RRDS has no keys, so the program cannot access records by key value.
Linear organization A
linear data set (LDS) is a type of
data set organization supported by VSAM. The LDS has a control interval size of 4096 bytes to 32768 bytes in increments of 4096. A LDS does not have embedded control information, because it does not contain control information, the LDS cannot be accessed as if it contained individual records. Addressing within an LDS is by Relative Byte Address (RBA), which allows it to be used by systems such as
IBM Db2 or the Operating system. The benefit of this is that systems such as the OS can access multiple disk spindles and view it as a single storage implementation. The limitations of this, though, is that this does not make this particularly useful to higher level abstraction levels. Data In Virtual (DIV) and Window services provide an alternative method to direct use of VSAM to access an LDS with a CI size of 4096. == Data access techniques ==