Virtual Storage Access Method (VSAM)
Virtual Storage Access Method (VSAM)
(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
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
MBT/TRN/VSAM /96 4
Indexed Sequential Organisation
MBT/TRN/VSAM /96 5
Direct Organisation Methods
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
MBT/TRN/VSAM /96 9
OS Supporting VSAM
MBT/TRN/VSAM /96 10
VSAM File Organisation
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
• 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
MBT/TRN/VSAM /96 15
Control Interval
MBT/TRN/VSAM /96 16
CI (Contd.)
CISZ
MBT/TRN/VSAM /96 17
Control Area
MBT/TRN/VSAM /96 18
CI Splits
MBT/TRN/VSAM /96 19
CI Split (Contd.)
New
Rec.
Full CI
Empty CI
FSPC US CF
After CI Split
MBT/TRN/VSAM /96 20
CA Splits
MBT/TRN/VSAM /96 21
VSAM (Generic) Catalog
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)
MBT/TRN/VSAM /96 27
KSDS (Contd.)
MBT/TRN/VSAM /96 28
KSDS (Contd.)
MBT/TRN/VSAM /96 29
KSDS - Index Component
MBT/TRN/VSAM /96 30
KSDS - Sequence Sets
MBT/TRN/VSAM /96 31
KSDS - Index Set
Index Set
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
Control Interval 2
FSPC
Rec G Rec H Rec I
Control Interval 3
Control Interval 4
MBT/TRN/VSAM /96 33
Thank You
To be continued…..
MBT/TRN/VSAM /96 34