Virtual Storage Access Method

from Wikipedia, the free encyclopedia

Virtual Storage Access Method ( VSAM , "method for accessing virtual memory ") is a method of accessing files that is used on IBM mainframe systems. The naming is based on the idea of ​​being able to address file contents like cells in the (virtual) main memory, which is supported with the help of an RBA ( Relative Byte Address ). This made it possible for the first time to no longer have to take into account the physical properties of the storage media ( plate cylinder, for example). VSAM is widely used among the z / OS and z / VSE operating systems .

Technically, a VSAM file consists of entries in a catalog, a VVDS (VSAM Volume Data Set) with metadata and at least one physical file on one or more disks. VSAM files are therefore also referred to as clusters (data heaps). There are different forms of VSAM clusters:

KSDS
( Key sequential dataset ) With this file type, VSAM accesses the data via an index that is stored in a separate dataset at the operating system level . Sequential access is also supported.
ESDS
( Entry sequential dataset ) With this file type, VSAM accesses the dataset of the file sequentially. The data records are read one after the other in exactly the order in which they are in the file. With the help of alternative indices, direct access can be made possible with the help of indices (key fields).
RRDS
( Relative Record Dataset ) VSAM accesses the data with the help of logical record numbers.
LDS
( Linear Dataset ) VSAM manages the data as an unstructured byte stream, which can, however, be interpreted by the application software.

VSAM files are created and managed under z / OS using the IDCAMS utility . They can be processed with all of the programming languages ​​commonly used there.

Database systems such as IMS (under z / VSE: DL / I), or DB2 use VSAM clusters to store their data. The catalogs of the z / OS catalog system (ICF, Integrated Catalog System) are VSAM files. Other central system components also use VSAM files (usually LDS) as data storage. Examples:

  • the hardware configuration (HCD)
  • the system logger
  • the zSeries file system zFS

Example: Use of a VSAM-KSDS

Since the key ( Key ) usually consist of several information such as "date of entry, item, quantity" is and VSAM cluster is sorted according to the key, there is a powerful and easy to access to all records that begin with a partial key.

For example, should all records ( Records ) are selected, was a posting date in January of 2003. VSAM offers the GENKEY option for this , which stands for Generic Key . When reading for the first time, the READ command is given a key that only consists of 6 bytes ("YYYYMM"). From there you can continue reading sequentially until the first 6 bytes of the key no longer match. In pseudocode it could look like this:

  • Set END to 'N'
  • Open the file in a VSAM environment with a generic key.
  • Read the first record whose key begins with "200301".
  • As long as END is not equal to 'J':
    • Write the record to the printer
    • Read the next record
    • When the end of the file is reached or the beginning of the key of the data record just read no longer matches:
      • Set END to 'J'
  • Close the file

literature