Control Interval
A control interval is the unit of data VSAM transfers between virtual and disk storage. It is similar to the concept of blocking in non-VSAM files. Each control interval can contain more than one logical record.
The size of CI must be between 512 bytes to 32K. Upto 8K bytes it must be multiple of 512, beyond this it is multiple of 2K. The length of the CI is specified at file creation time.
For index component, the size of CI is 512, 1K, 2K or 4K bytes.
A Control Inverval consists of records, free space and control field information as shown below
Figure 3.1 Contents of Control Interval
In th Control Interval shown above Rec1, Rec2, Rec3 are records. Free Space is where new records can be inserted.
Figure 3.2 Contents of Control Field
Control Interval Descriptor Field(CIDF) contains information about available space within CI. Record Descriptor Field (RDF) contains the length of each record and how many adjacent records are of the same length. There’s one RDF for each record in variable length records.
There will be only two RDFs per CI in case of fixed length files. One RDF specifies the length of the record and the second RDF specifies how many records are there in the CI. Each RDF is of 3 bytes .
VSAM groups control intervals into contiguous, fixed length areas of storage called Control Areas. Maximum size of a CA is 1 cylinder. You can also specify freespace in CA. The total number of CI/CA in a Cluster is determined by VSAM.
CONTROL AREA
Figure 3.3 Control Area
Spanned Records
Spanned records are records larger than the specified CI size. That is they span more than one CI. So one spanned record may be stored in several CIs. Each CI that contains a record segment of a spanned record has two RDFs. The right RDF gives the length of the segment and the left gives the update number of the segment. Spanned records can exist only in ESDS and KSDS.
A CI that contains a record segment of a spanned record contains no other data. Records can span Control Intervals but not Control Areas. For KSDS the entire key field of the spanned record must be in the first Control Interval.
Figure 3.4 Spanned Record
ESDS
ESDS is a sequential dataset. Records are retrieved in the order in which they are written to the dataset. Additions are made always at the end of the file. Records can be retrieved randomly by using RBA(Relative Byte Address). RBA is an indication of how far, in bytes, each record is displaced from the beginning of the file.
KSDS
In Key Sequenced Datasets logical records are placed in the dataset in the ascending collating sequence by the key field.
Rules for key
• Key must be unique in a record
• Key must be in same position in each record and key data must be contiguous
• When a new record is added to a dataset it is inserted in its collating sequence by key
A KSDS consists of two components index component and data component
DATA Component :- Contains control areas which in turn contains Control Intervals as shown in Figure 3.5
Figure 3.5 Contents of Control Area
KSDS Structure
Figure 3.6 Contents of KSDS Index
The first level of index is called a Sequence set. The Sequence set consists of Primary keys and pointers to the Control Intervals holding records with these primary keys. The Sequence set is always in sequential order of the primary keys. The Control Intervals may be in any order. VSAM uses the Sequence Set to access records in the KSDS sequentially.
The index component is a separate entity with a different CI size , a different name and can be stored on a different volume.
Control interval splits can occur in Indexes also
Sequence Set
CI CI CI CI
Figure 3.7 Contents of Sequence Set
Index Set
Index
component
Sequence Set Sequence Set
CA1 CA2
Figure 3.7 Contents of Index Set
Figure 3.8 Inserting a new record into a KSDS
Before Control Interval Split
Full
Control Interval
Figure 3.9 Inserting a new record into a full CI
Figure 3.10 After Control Interval Split
Sequence Set
0
100
200
Figure 3.11a Effect of Control Interval Split on Sequence Set
0
100
200
Figure 3.11b Effect of Control Interval split on Sequence Set
Back to VSAM index
Wednesday, May 27, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment