0% found this document useful (0 votes)
203 views34 pages

Virtual Storage Access Method (VSAM)

The document provides an overview of Virtual Storage Access Method (VSAM) in IBM mainframe systems. It describes VSAM objects like clusters, control intervals, and catalogs. It explains the different types of VSAM file organizations including entry-sequenced data sets (ESDS), relative record data sets (RRDS), and key-sequenced data sets (KSDS). It also covers VSAM services, alternate index processing, and COBOL programming using VSAM.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
203 views34 pages

Virtual Storage Access Method (VSAM)

The document provides an overview of Virtual Storage Access Method (VSAM) in IBM mainframe systems. It describes VSAM objects like clusters, control intervals, and catalogs. It explains the different types of VSAM file organizations including entry-sequenced data sets (ESDS), relative record data sets (RRDS), and key-sequenced data sets (KSDS). It also covers VSAM services, alternate index processing, and COBOL programming using VSAM.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 34

Virtual Storage Access Method

(VSAM)
• Introduction to VSAM
• VSAM Objects
• VSAM Data Organisation
• VSAM Services (AMS)
• Alternate Index Processing
• COBOL Programming using VSAM

MBT/TRN/VSAM /96 1
Introduction to VSAM

• Data Organisation Methods


• Drawbacks of Native Access Methods
• Requirements of an Access Methods
• What is VSAM ?
• VSAM File Organisations

MBT/TRN/VSAM /96 2
Data Organisation Methods

• Sequential Organisation
SAM
• Indexed Sequential Organisation
ISAM, BISAM, QISAM
• Direct Organisation
BDAM

MBT/TRN/VSAM /96 3
Sequential Organisation

• Records are stored sequentially and


accessed sequentially
• Can be stored in sequence of a key
(not mandatory)
• Access methods that support this
organisation :
° Sequential Access Method - SAM
° Basic Sequential Access Method - BSAM
° Queued Sequential Access Method -
QSAM

MBT/TRN/VSAM /96 4
Indexed Sequential Organisation

• Records are stored sequentially but


can be accessed sequentially or
directly
• There is an index component and a
data component
• Access methods that support this
organisation :
° Indexed Sequential Access Method -
ISAM
° Basic Indexed Sequential Access Method
- BSAM
° Queued Indexed Sequential Access
Method - QISAM

MBT/TRN/VSAM /96 5
Direct Organisation Methods

• Direct access between record and


physical DASD address
• Algorithims used to calculate physical
address where records should be
stored
• Physical address could be :
° Cylinder, track, sector or data record
address
° Address of data file and a record number
relative to the start of that file

MBT/TRN/VSAM /96 6
Drawbacks of Native Access
Methods
• QSAM
° All previous records have to be read to
access a record
° Physical deletion and insertion of records
not possible
• ISAM
° Space used by deleted record cannot be
recovered unless file is reorganised
• BDAM
° Large gaps between records
° More than one record may compute to the
same DASD address

MBT/TRN/VSAM /96 7
Requirements of an Access
Method
• Support for On-line and Batch
Processing
• Support of different types of access
and conversion between access
methods
• Central control of creation, access,
security and deletion of files
• Device independence
• Failure and recovery procedures
• Transfer of data from one OS to
another

MBT/TRN/VSAM /96 8
VSAM

• IBM licensed program which provides


file organisation and access needs for
application development
• Supports Sequential, Indexed,
Relative and Linear data sets
• VSAM files are referred to as clusters
• VS COBOL II supports only VSAM
and not ISAM or BDAM
• VSAM is not a DBMS or language or
a communication system

MBT/TRN/VSAM /96 9
OS Supporting VSAM

• IBM mainframes file management is


handled by VSAM running under
DOS/VSE or MVS
• OS VSAM Version
° OS/VS1 VS1/VSAM
° MVS/SP, MVS/VSAM
MVS/XA,
MVS/ESA
° DOS/VSE VSE/VSAM
° VM CMS/VSAM

MBT/TRN/VSAM /96 10
VSAM File Organisation

• VSAM supports three types of file


organisation
° Sequential - Entry Sequenced Datasets
(ESDS)
° Indexed - Key Sequenced Datasets
(KSDS)
° Relative - Relative Record Datasets
(RRDS)
• VSAM also support Linear Datasets
(LDS)

MBT/TRN/VSAM /96 11
VSAM File Organisation (Contd.)

• ESDS
° Records are stored in order which they are
entered
• KSDS
° Key uniquely identifies record
° Consists of data and index component
° Index points to relative location in file
• RRDS
° Record has a relative record number
° Number is used to access the record
• LDS
° Data is stored as a long stream of bytes
with no division into records

MBT/TRN/VSAM /96 12
Features of VSAM

• File information is stored in central


VSAM catalog
• Password protection for files with
read, update and full access modes
• Space allocation is dynamic
• Rapid access and insertion of records
• Free space used for automated file
reorganisation
• JCL’s for VSAM files are simpler
• Portability of data between systems
• Ease of conversions between access
methods
• Data recovery is possible after failures
MBT/TRN/VSAM /96 13
VSAM OBJECTS

• Cluster
• Control Interval
• Control Area
• Index Component
° Sequence Set
° Data Set
• Generic Catalog Facility
(VSAM Catalog)
• Integrated Catalog Facility (ICF)

MBT/TRN/VSAM /96 14
VSAM Clusters

• Cluster is a logical name for a VSAM


dataset
• Includes data component and incase of
KSDS the index component as well
• Data and Index are two physical
datasets viewed as a cluster

MBT/TRN/VSAM /96 15
Control Interval

• Records in VSAM are stored in


Control Intervals
• Unit in which data is read or written
(Equivalent to block)
• Size of a CI is defined at the time of
creation of dataset
• Spanned records occupy more than
one CI

MBT/TRN/VSAM /96 16
CI (Contd.)

• CI contains four areas


° Logical Record area (LRA) - contains
data records
° CI Free Space (FSPC) - space reserved
for future insertions
° Unused Space (US) - space which is
never used (CI size may not be a multiple
of record size)
° Control Fields ( CF) - control information
on the CI ( one CIDF) and data records
contained within (one or more RDF)
LRA

Rec1 Rec2 Rec3 FSPC US CF

CISZ

MBT/TRN/VSAM /96 17
Control Area

• Fixed length unit of DASD storage


• CA consists of many CI’s
• VSAM’s internal unit for allocating
space within a cluster
• VSAM computes an optimum CA size
which can vary depending on the unit
of allocation

MBT/TRN/VSAM /96 18
CI Splits

• Occurs when there in no space for


record insertion within a CI
• Record is added at the point of split
• Subsequent records after insertion
point are written on to a fresh CI
• Each CA has a percentage of free CI’s
• Only KSDS have CI splits

MBT/TRN/VSAM /96 19
CI Split (Contd.)
New
Rec.
Full CI

Rec1 Rec2 Rec3 Rec4 Rec5 US CF

Empty CI

FSPC US CF

After CI Split

Rec1 Rec2 New FSPC US CF


Rec

Rec3 Rec4 Rec5 FSPC US CF

MBT/TRN/VSAM /96 20
CA Splits

• Occurs when there in no space for


record insertion due to an absence of
free CI’s
• Split is similar to a CI split
• CA splits continue until space
allocation limits are exceeded

MBT/TRN/VSAM /96 21
VSAM (Generic) Catalog

• VSAM catalog contains important


information about datasets including :
° Location of the file
° Attributes like record size and key
location
• Used for monitoring file creation and
management through commands like
Define and listcat

MBT/TRN/VSAM /96 22
VSAM (Generic) Catalog
Structure
• VSAM catalogs are of two types i.e.
Master & User Catalogs
• Master catalogs
° Each systems has one Master catalog
° Contains entry for VSAM and Non
VSAM datasets
° Contains entries that point to User
Catalogs
° Contains information about System
Datasets
• User Catalogs contains datasets
specific to user applications

MBT/TRN/VSAM /96 23
Generic Catalog Structure -
Shortcomings
• Difficult to recover data in event of a
failure
• Fine tuning to improve performance is
difficult
• VSAM catalogs owns the volume on
which it resides
• Volume cannot contain datasets
belonging to different volumes

MBT/TRN/VSAM /96 24
Entry Sequenced Data Sets
(ESDS)
• Stored in physical sequence of entry
• Can have spanned records
• Insertion of records midway or
physical deletion is not possible
• Record can be replaced with one of a
similar lengths
• Sequential or Direct access is possible
through RBA
• Can have multiple Alternate Index
• Ideal for applications where sequence
of data is not important and order
corresponds to sequence of events

MBT/TRN/VSAM /96 25
Relative Record Datasets (RRDS)

• Contains fixed length records


• Records have a relative record number
through which they are accessed
• Direct access is possible without the
overhead of an index
• Cannot have spanned records
• Sequential or direct access is possible
• Records can be inserted deleted or
moved without affecting position of
other records
• VSAM first calculates address of CI
and then record position within it
• Suitable for applications that use fixed
length records
MBT/TRN/VSAM /96 26
Key Sequenced Datasets (KSDS)

• Records are stored in key sequence


• Each record has a key field that
contains unique value
• Index relates key value with relative
location of data records
• Data and index are separate entries
• Records can be fixed or variable
length
• Spanned records are also possible
• Permits setting up an alternate index

MBT/TRN/VSAM /96 27
KSDS (Contd.)

• With sequential access records are


read in consecutive order based on
primary key
• Index set points to sequence set which
in turn points to CI containing the
records
• Sequence set is the first level of index
° Contains highest primary key value for
the CI and pointer to the CI
• Key field occupies the same position
in each record
• Key field is specified by the offset and
the length

MBT/TRN/VSAM /96 28
KSDS (Contd.)

• KSDS makes full use of available


space for record insertion and deletion
• When there is insufficient room to add
more records a CI split occurs
• KSDS is ideal when random or
dynamic access is required
• Sequential access is slow as records
must still be accessed through the index
• KSDS has two components : - Data and
Index
• Data component contains records and
index components stores record
location

MBT/TRN/VSAM /96 29
KSDS - Index Component

• Each KSDS has a data and index


component
• Index component consists of index
sets and sequence sets

MBT/TRN/VSAM /96 30
KSDS - Sequence Sets

• Lowest level of Index


• Index entry consists of a sequence set
consists of :
° Primary record key of a data record
contained in the CI which it points to
° Pointer to the CI containing the record
• Pointer is the relative byte address of
the CI from the beginning of the
dataset
• CI may not be in sequential order
• Sequence set is always in sequential
order of record keys

MBT/TRN/VSAM /96 31
KSDS - Index Set

• Second level of Index


• Each entry on an index set consists of
a primary key
• A pointer to sequence set that contains
the primary key
• Index set can have one or more levels
• The highest level has only one record

Index Set
Key Ptr Key Ptr

Sequence Set Sequence Set


Key Ptr Key Ptr Key Ptr Key Ptr

CA CA
CI CI CI CI CI CI

MBT/TRN/VSAM /96 32
KSDS
Index Component : Sequence Set
Key1 Ptr1 Key2 Ptr2 Key3 Ptr3 Key4 Ptr4
...........
C F I L

Data Component
Control Interval 1

Rec A Rec B Rec C FSPC

Control Interval 2

FSPC
Rec G Rec H Rec I

Control Interval 3

Rec D Rec E FSPC

Control Interval 4

Rec J Rec K Rec L FSPC

MBT/TRN/VSAM /96 33
Thank You

To be continued…..

MBT/TRN/VSAM /96 34

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy