MVS/ESA Fundamentals of VSAM © Copyright IBM Corp., 2000, 2004. All rights reserved.
-
Upload
debra-goodman -
Category
Documents
-
view
235 -
download
0
Transcript of MVS/ESA Fundamentals of VSAM © Copyright IBM Corp., 2000, 2004. All rights reserved.
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 2
UNIT
Foundation Concepts
VSAM Data Set Types
VSAM Terminology
Access Method Services
Topics:
VSAM Concepts and Terms
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 3
What is an access method?
Most computer applications are designed to manipulate data and generate results based on the data. Data must be stored in a way that its retrieval is easy and quick.
Access methods are ways to maximize the efficiency of data storage and retrieval.
Access Methods
An access method acts as an interface between a processing program and the operating system. Continued…
Unit: VSAM Concepts and Terms
Concepts
Access Methods
DASD
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 4
Virtual Storage Access Method
Virtual Storage Access Method (VSAM) is the first access method specifically designed to operate in a virtual storage environment.
VSAM is more compatible with operating systems MVS, MVS/XA and MVS/ESA than other access methods.
The compatibility of VSAM with various operating systems provides greater efficiency for the application programs using VSAM and also for the overall environment.
Continued…
Unit: VSAM Concepts and Terms
Concepts
VSAM
DASD
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 5
VSAM retrieves a record by following these steps:
1. VSAM interprets the processing program’s
logical request and determines what services are desired.
2. VSAM makes the required Input or Output (I/O) request(s) to the operating system.
3. The operating system performs the physical I/O operation(s) between the device and the storage.
4. VSAM locates and extracts the desired data before returning it to the processing program.
Virtual Storage Access Method (cont’d)
Continued…
Unit: VSAM Concepts and Terms
Concepts
Operating System
DASD
VSAM
Processing Program
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 6
Two important variations in the process of retrieving a record are:
• A record requested by a processing program may already be in virtual storage. No physical I/O operations are needed in such a case.
• Sometimes due to the way VSAM stores data and variety of processing options it supports, it must issue several I/O requests to retrieve a single record.
Virtual Storage Access Method (cont’d)
Continued…
Unit: VSAM Concepts and Terms
Concepts
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 7
VSAM groups individual data records into larger units in order to reduce the number of I/O requests required when sequentially retrieving records.
These larger units are transferred between the Direct Access Storage Device (DASD) and virtual storage by the operating system.
Virtual Storage Access Method (cont’d)
Continued…
Unit: VSAM Concepts and Terms
Concepts
record record record
recordrecord record
DASD
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 8
What is the role of VSAM?
VSAM acts as an interface between processing programs and the operating system.
A processing program invokes VSAM routines as subroutines.
In Assembler Language programs, subroutines are invoked by issuing VSAM macros. In High Level Languages, the language compilers convert I/O statements into calls to the appropriate VSAM routines. When the I/O request has been processed, control is returned to the processing program.
Virtual Storage Access Method (cont’d)
Unit: VSAM Concepts and Terms
Concepts
Topic: Foundation Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 9
VSAM supports the following data set types:
• Entry-Sequenced Data Set (ESDS)
• Key-Sequenced Data Set (KSDS)
• Relative Record Data Set (RRDS)
• Linear Data Set (LDS)
Overview of Data Set Types
Unit: VSAM Concepts and Terms
Concepts
Topic: VSAM Data Set Types
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 10
Records in an ESDS are stored in the order in which they are written and are retrieved by addressed access. Records are loaded irrespective of their contents and their byte addresses cannot be changed.
ESDS is also referred to as a sequential VSAM data set. This is because records in an ESDS are normally processed sequentially.
ESDS is best suited for applications where most processing is done sequentially.
Entry-Sequenced Data Set
Unit: VSAM Concepts and Terms
Concepts
Topic: VSAM Data Set Types
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 11
Records in a KSDS are stored in key sequence and are controlled by an index. The key field of records determine the order in which records are stored.
In a KSDS, records can be processed both sequentially and randomly using their key field values.
The advantages of KSDS are:• Sequential processing is useful for retrieving records in the sorted form• Random or direct processing of records is useful in on-line applications
Key-Sequenced Data Set
Unit: VSAM Concepts and Terms
Concepts
Topic: VSAM Data Set Types
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 12
Relative Record Data Set
Records in an RRDS are loaded into fixed-length or
variable length slots. These records are represented
by the Relative Record Numbers (RRNs) of their
slots.
A processing program uses RRN to provide random
access to records.
The records in an RRDS can also be accessed sequentially in its RRN order. It is also possible to convert key values into RRNs.
Accessing data using RRNs is preferred by many applications, such as inventory file management.
Continued…
Unit: VSAM Concepts and Terms
Concepts
R1 R2 R3
Slots
1 2 3 4
Relative Record Numbers
Topic: VSAM Data Set Types
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 13
Linear Data Set
LDS is a data set containing only a contiguous string of data bytes with no intervening control information.
An LDS is divided into blocks. These blocks can be sequentially retrieved by a processing program in physical order. A processing program can group several logical records together into a single block
LDS can be kept permanently in store for enhanced performance.
The purpose of the LDS data set type is to provide a format that can be used more easily with the extended addressing feature found in Multiple Virtual Storage / Enterprise Systems Architecture (MVS/ESA).
It is used for special applications requiring large amount of data to be maintained in virtual storage.
Application programs prefer an ESDS to an LDS. ESDS provides same processing abilities and can block and unblock logical records automatically.
Continued…
Unit: VSAM Concepts and Terms
Concepts
Topic: VSAM Data Set Types
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 14
A cluster is the collection of physical data sets that make up one logical data set.
The concept of a cluster is more suited for a KSDS.
A KSDS cluster has two data sets. One data set holds the actual data records. The other data set contains an index component.
The index component permits the direct retrieval of data.
What is a Cluster?
Continued…
Unit: VSAM Concepts and Terms
Concepts
KSDS.CLUSTER
KSDS.INDEX
KSDS.DATA
Topic: VSAM Terminology
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 15
What is a control interval?
A control interval is the amount of data transferred between the device and virtual storage.
When a record is read from or written to a data set, VSAM groups individual data records into larger units of storage. These units of storage are called control intervals.
Control Interval
Continued…
Unit: VSAM Concepts and Terms
Concepts
Topic: VSAM Terminology
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 16
A control interval is the amount of data transferred between the device and virtual storage.
VSAM groups individual data records into larger units of storage. These units of storage are called control intervals.
All control intervals for a given data set are of the same size. However, the records within a control interval can vary in length.
Control Interval (cont’d)
Unit: VSAM Concepts and Terms
Concepts
R1 R1 R1Unused Space
420
340
220
9 18 00 5 5
A 2k (2048 bytes) Control Interval
Topic: VSAM Terminology
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 17
The control intervals for a data set are grouped Into one or more control areas.
The number of control intervals in a control area is fixed by VSAM.
Control Area
Unit: VSAM Concepts and Terms
Concepts
05 08 09 10
12 14 15 20
21
29
22
30
24 25
35 36
Control Area with Control Intervals
Topic: VSAM Terminology
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 18
What is Access Method Services?
VSAM uses certain utility programs for managing and maintaining data sets.
Access Method Services (AMS) is a utility that defines VSAM data sets and allocates space for them. It also converts indexed sequential data sets to KSDS with indexes.
AMS can also be used to perform some functions for non-VSAM data sets.
Access Method Services
Continued…
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 19
What is IntegrateD Catalog Access Method Services?
IntegrateD Catalog Access Method Services (IDCAMS) is the program name for VSAM’s AMS utility. IDCAMS is easy to use and multipurpose in nature.
IDCAMS performs the following functions:
Access Method Services (cont’d)
• It defines a data set
• It loads a data set
• It copies or backs up a data set
• It prints the contents of a data set
• It changes certain attributes of a data set
• It lists data set attributes and statistical information
• It deletes a data set
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 20
Some of the non-VSAM utility programs are:
• IEBGENER– Used to copy a SAM data set
• IEBCOPY – Used to copy a partitioned data set
Non-VSAM Utility Programs
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 21
What is defining a data set?
The process of creating catalog entries for a VSAM data set and allocating space for them is called defining the data set.
A data set must be defined before it is loaded with data or accessed by a processing program.
VSAM data sets can be defined using either IDCAMS or JCL.
Defining a VSAM Data Set with IDCAMS
Continued…
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
DASD
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 22
The DEFINE CLUSTER function of IDCAMS is used to give the cluster a name and describe its characteristics.
Listed below are some of the characteristics that can be specified during a DEFINE CLUSTER operation:
Defining a VSAM Data Set with IDCAMS (cont’d)
• Cluster name
• Names of the data and index components
• Volume(s) on which the data set is to reside
• Space requirements of the data set
• Record size
• Position and length of the key field for KSDS
• Retention period
• Data set passwords
• Data set type
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 23
Passwords are implemented to control access to data sets and other system resources.
When a data set is defined, up to four passwords, each representing a different level of protection, can be defined.
You can assign one password to control read access. Another password can be assigned for update access.
Passwords
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
Password
DASD
VSAM
Program
Update Read
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 24
Once a data set has been defined, it needs to be loaded with data. The IDCAMS REPRO function is used for initial loading of a data set.
The REPRO function can be used to:
• Load a VSAM data set from a SAM, ISAM or another VSAM data set
• Copy a VSAM data set to a SAM or VSAM but not to an ISAM data set
Initial Loading
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 25
IDCAMS can be used to perform a variety of data set management functions.
Listed below are some of the commonly used IDCAMS functions:
• PRINT – Prints a VSAM data set
• ALTER – Changes certain attributes of a VSAM data set
• LISTCAT – Lists data set attribute and statistical information
• DELETE – Deletes a data set
Other IDCAMS functions
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 26
The advantages of VSAM are:
• VSAM supports more data set types• Simplifies record processing• Supports a variety of I/O techniques• Provides greater efficiency for the application programs and for the overall
environment
The major limitation of VSAM is:
• Its data sets must reside on DASD. They cannot be created on tape.
Advantages and Limitations of VSAM
Unit: VSAM Concepts and Terms Topic: Access Method Services
Concepts
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 27
Unit: Key-Sequenced Data Sets Topic: KSDS Organization and Storage
Concepts
Index
Data
Highest Level Index Record
Continued…
The index component of a KSDS has the following features:
• The index component is divided into control intervals• Each index control interval is treated as a single record that is divided into
index entries• The index records resemble a tree structure with a single index record at the
highest level
The Index Component
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 28
Unit: Key-Sequenced Data Sets Topic: KSDS Organization and Storage
Concepts
Index
Data
Index Set
Sequence Set
The Index Component (cont’d)
There are two types of index records. They are:
• Index Set: It consists of the records in the highest level of the index• Sequence Set: It consists of the records in the lowest level of the index
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 29
Continued…
Concepts
Unit: Key-Sequenced Data Sets Topic: KSDS Processing Options
17 26 36 50 54 66 74 99
08 09 11 14
18 19 25 26
27 30 31 33
37 40 43 47
51 52 53 54
55 56 57 59
67 69 70 73
75 84 88 90
Current Record
Current Index Entry
Consider a KSDS shown in the above diagram, which is being processed sequentially.
Assume that the processing program has read all the records up to the record with key 37. The indicated sequence set record and data control interval would currently be in virtual storage.
In response to the next sequential read request, VSAM will return the record at the current position. In this case, it would return the record with key 40.
Sequential Access of Records (cont’d)
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 30
Continued…
Concepts
Unit: Key-Sequenced Data Sets
17 26 36 50 54 66 74 99
08 09 11 14
18 19 25 26
27 30 31 33
37 40 43 47
51 52 53 54
55 56 57 59
67 69 70 73
75 84 88 90
Current Record
Current Index Entry
Once the last record in a control interval has been returned to the processing program, VSAM uses the next entry in the sequence set record to retrieve the next control interval from the present control area.
Once the last control interval in the control area has been processed, VSAM uses the horizontal pointer in the sequence set record to retrieve the next sequence set record.
Sequential Access of Records (cont’d)
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 31
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
A KSDS can process records randomly by supplying the key of the desired records.
Consider the KSDS index and data components illustrated in the above diagram.
Random Access of Records
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 32
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
Suppose the record key supplied by the processing program is 53. Each time a random request is issued, VSAM begins by retrieving the highest level index record and searching through its entries.
Random Access of Records (cont’d)
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 33
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
VSAM examines the key value in each entry until it finds a key which is greater than or equal to the desired key. In this example, VSAM will stop at the second entry in the highest level index record (53 is greater than 50 but less than 99).
Random Access of Records (cont’d)
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 34
Random Access of Records (cont’d)
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
Using the corresponding pointer, the next lower level index record is retrieved. This record is processed until a key which is greater than or equal to the desired key is found.
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 35
Random Access of Records (cont’d)
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
Eventually, the search will lead to a sequence set record. Within the record, VSAM locates the first key having a key value greater than or equal to the key value of the desired record.
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 36
Random Access of Records (cont’d)
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
The pointer in this entry is used to retrieve a data control interval. VSAM searches the control interval sequentially, for the desired record. If the record is present, VSAM returns it to the processing program. If not, VSAM signals a record-not-found condition.
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 37
Random Access of Records (cont’d)
Continued…
Concepts
Unit: Key-Sequenced Data Sets
08
50 99
26 50 66 99
17 26 36 50 54 66 74 99
09 11 14 27 30 31 33 51 52 53 54 67 69 70 73
18 19 25 26 37 40 43 47 55 56 57 59 75 84 88 90
Searching for a record with a key value of 53
The pointer in the index records define a path that VSAM follows to locate a record.
The path VSAM would follow in this example is illustrated in the above diagram.
Topic: KSDS Processing Options
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 38
VSAM
377Vert,
Pntr. 619 Vert.Pntr 800
Vert.
Pntr.
280Vert,
Pntr. 327 Vert.Pntr 377
Vert.
Pntr. 469Vert,
Pntr. 619 Vert.Pntr … …. 700
Vert,
Pntr. 800 Vert.Pntr … …
Index Set
Sequence Set Sequence Set Sequence SetHoriz.
Pntr.
Horiz.
Pntr.
627
642
658
675
700
251
269
280
FREE
312
318
327
FREE
345
346
377
FREE
394
400
449
469
FREE
500
502
598
617
619
717
722
746
748
800
FREE FREE
ControlInterval
ControlInterval
ControlInterval
Control Area Control Area Control Area
MVS/ESA Fundamentals of VSAM
© Copyright IBM Corp., 2000, 2004. All rights reserved. Page 39
377Vert,
Pntr.619Vert.Pntr 700
Vert.
Pntr.
280Vert,
Pntr.327Vert.Pntr 377
Vert.
Pntr. 469Vert,
Pntr.598Vert.Pntr 619Vert.
Pntr.
Index Set
Sequence Set Sequence Set Sequence Set
Horiz.
Pntr.
Horiz.
Pntr.
251
269
280
FREE
345
346
377
FREE
394
400
410
449
469
500
502
598
FREE
Control Area Control Area
658Vert,
Pntr.700Vert.Pntr
Vert.Pntr
…
627
642
658
FREE
FREE
Control Area
800Vert.
Pntr.
Sequence Set
730Vert,
Pntr.800Vert.Pntr
Vert.Pntr. …
FREE
Control Area
312
316
318
327
FREE
617
618
619
FREE
675
680
700
FREE
746
748
800
FREE
717
722
730
FREE
Horiz.
Pntr.
Control Interval Split
Control Interval Split
Control Area Split
VSAM