Documente Academic
Documente Profesional
Documente Cultură
1-1
Three Types of VSAM files
KSDS
Keyed Sequence Data Set
RRDS
Relative Record Data Set
ESDS
Entry Sequence Data Set
1-2
KSDS
Allows for users to access records
sequentially or randomly
Includes an index and data components
A CLUSTER consists of both the index and
data components together
Index relates a value in a key field to the
actual location of the record on disk
Index is only used in random (or dynamic)
processing
1-3
VSAM Data Component Storage Concepts
1-4
Approximate number of records
in a CI
1-5
Records in a CI
1-6
CI in a CA
1-7
Freespace in a CI
1-8
CI Splits
If there is no freespace in the CI in
which the record is to be inserted:
CI split
Half of the records in the CI are moved to a
free CI in the same CA
The inserted record is then inserted in the
proper CI
These happen routinely and are
accomplished quickly
1-9
CA splits
1-10
Avoid CA splits
Reorganization of files
Import: Copy the VSAM file to a sequential
dataset
Export: Delete and reload the VSAM file from
the sequential data set: Resets the freespace
as in the define cluster
Allocate adequate freespace
Analyze the primary key
1-11
Primary Key Analysis
Is the pattern in the PK
Example: The Financial Aid office must
keep three years of data on-line.
• Previous year: State reporting
• Current year: Distributing aid to students
• Next year: Granting/guaranteeing aid for
next year
1-12
Primary Key Analysis
Key options for the financial aid file
1-digit year + SSN
• Little on-line activity on first third of file
• Most “adds” are in last third: CI/CS split
likely
SSN + 1 digit year
• Activity is spread evenly throughout the file
• Recommended
1-13
VSAM Index Component
1-14
Primary Key Index and Data
1-15
Primary Key Index and Data
Sequence Set
Lowest level of the index component
Contains information that relates key values
to a specific CI
Links the highest PK in a CI to the address of
that CI
• Stores all the key-address pairs for the Cis in a CA
in one CI of the sequence set
• There is a separate CI in the sequence set for each
CA in the data
1-16
Primary Key Index and Data
Index Set
Highest level of the index component
Key-address pairs stored in one CI (can be
stored in main memory for processing
efficiency)
• Address Pointer links to address of the appropriate
sequence set
• Based on size of data component (number of
cylinders or CA needed to store data component),
you may need a intermediate index
1-17
Alternate Index and Data Component
1-18
Alternate Index
1-19
Relative Record Data Set (RRDS)
1-20
RRDS
1-21
RRDS
Collision
If hashing routine results is same RRN for
two different PK
Must set secondary searching technique in
case of collisions
• Usually linear probing: check the next
record up to a maximum number of tries.
Needed to know if record to be added already
exists
Needed to determine if record to be retrieved
exists without reading entire file
1-22
RRDS
Advantages
No index overhead
Direct relationship between data and
location of the data
Permits both random and sequential
processing
If good hashing routine with minimal
collisions: performance efficiency is
excellent
1-23
RRDS
Disadvantages
Storage efficiency
Collisions
Difficulty in determining good hashing
technique
• Difficulty with alphabetic key
Does NOT support the concept of FK or AI
Not widely used
1-24
ESDS
1-25
ESDS
1-26
ESDS