390 likes | 522 Views
UNIT. VSAM Concepts and Terms. Topics:. Foundation Concepts VSAM Data Set Types VSAM Terminology Access Method Services. DASD. Access Methods. Topic : Foundation Concepts. Unit: VSAM Concepts and Terms. Access Methods. What is an access method?
E N D
UNIT VSAM Concepts and Terms Topics: • Foundation Concepts • VSAM Data Set Types • VSAM Terminology • Access Method Services
DASD Access Methods Topic: Foundation Concepts Unit: VSAM Concepts and Terms Access Methods • 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. An access method acts as an interface between a processing program and the operating system. Continued… Concepts
DASD VSAM Topic: Foundation Concepts Unit: VSAM Concepts and Terms 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… Concepts
DASD Operating System VSAM Processing Program Topic: Foundation Concepts Unit: VSAM Concepts and Terms Virtual Storage Access Method (cont’d) • 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. Continued… Concepts
Topic: Foundation Concepts Unit: VSAM Concepts and Terms Virtual Storage Access Method (cont’d) • 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. Continued… Concepts
DASD record record record record record record Topic: Foundation Concepts Unit: VSAM Concepts and Terms Virtual Storage Access Method (cont’d) • 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. Continued… Concepts
Topic: Foundation Concepts Unit: VSAM Concepts and Terms Virtual Storage Access Method (cont’d) • 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. Concepts
Topic: VSAM Data Set Types Unit: VSAM Concepts and Terms Overview of Data Set Types • 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) Concepts
Topic: VSAM Data Set Types Unit: VSAM Concepts and Terms Entry-Sequenced Data Set • 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. Concepts
Topic: VSAM Data Set Types Unit: VSAM Concepts and Terms Key-Sequenced Data Set • 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 Concepts
Slots R1 R2 R3 1 2 3 4 Relative Record Numbers Topic: VSAM Data Set Types Unit: VSAM Concepts and Terms 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… Concepts
Topic: VSAM Data Set Types Unit: VSAM Concepts and Terms 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… Concepts
KSDS.CLUSTER KSDS.INDEX KSDS.DATA Topic: VSAM Terminology Unit: VSAM Concepts and Terms What is a Cluster? • 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. Continued… Concepts
Topic: VSAM Terminology Unit: VSAM Concepts and Terms Control Interval • 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. Continued… Concepts
A 2k (2048 bytes) Control Interval R1 R1 R1 Unused Space 4 2 0 3 4 0 2 2 0 • 9 1 • 0 • 0 5 • 5 Topic: VSAM Terminology Unit: VSAM Concepts and Terms Control Interval (cont’d) • 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. Concepts
Control Area with Control Intervals 05 08 09 10 12 14 15 20 21 22 24 25 29 30 35 36 Topic: VSAM Terminology Unit: VSAM Concepts and Terms Control Area • 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. Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Access Method Services • 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. Continued… Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Access Method Services (cont’d) • 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: • 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 Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Non-VSAM Utility Programs • Some of the non-VSAM utility programs are: • IEBGENER– Used to copy a SAM data set • IEBCOPY – Used to copy a partitioned data set Concepts
DASD Topic: Access Method Services Unit: VSAM Concepts and Terms Defining a VSAM Data Set with IDCAMS • 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. Continued… Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Defining a VSAM Data Set with IDCAMS (cont’d) • 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: • Record size • Position and length of the key field for KSDS • Retention period • Data set passwords • Data set type • 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 Concepts
DASD Update Read Password VSAM Program Topic: Access Method Services Unit: VSAM Concepts and Terms Passwords • 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. Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Initial Loading • 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 Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Other IDCAMS functions • 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 Concepts
Topic: Access Method Services Unit: VSAM Concepts and Terms Advantages and Limitations of VSAM • 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. Concepts
Highest Level Index Record Index Data Topic: KSDS Organization and Storage Unit: Key-Sequenced Data Sets The Index Component • 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 Continued… Concepts
Index Set Index Sequence Set Data Topic: KSDS Organization and Storage Unit: Key-Sequenced Data Sets 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 Concepts
Current Index Entry 17 26 36 50 54 66 74 99 08 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 Current Record Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Sequential Access of Records (cont’d) • 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. Continued… Concepts
Current Index Entry 17 26 36 50 54 66 74 99 08 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 Current Record Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Sequential Access of Records (cont’d) • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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). Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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. Continued… Concepts
Searching for a record with a key value of 53 50 99 26 50 66 99 17 26 36 50 54 66 74 99 08 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 Topic: KSDS Processing Options Unit: Key-Sequenced Data Sets Random Access of Records (cont’d) • 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. Continued… Concepts
377 469 700 280 Vert, Pntr. Vert, Pntr. Vert, Pntr. Vert, Pntr. 327 619 619 800 Vert. Pntr Vert. Pntr Vert. Pntr Vert. Pntr … 800 … 377 … …. Vert. Pntr. Vert. Pntr. 251 312 345 394 627 500 717 346 318 269 642 400 722 502 327 377 280 449 746 598 658 FREE FREE FREE 617 675 748 469 700 800 FREE 619 VSAM Index Set Sequence Set Sequence Set Sequence Set Horiz. Pntr. Horiz. Pntr. FREE FREE ControlInterval ControlInterval ControlInterval Control Area Control Area Control Area
730 658 280 469 Vert, Pntr. Vert, Pntr. Vert, Pntr. Vert, Pntr. 598 327 700 800 377 Vert. Pntr Vert. Pntr Vert. Pntr Vert. Pntr Vert, Pntr. Vert. Pntr 377 619 Vert. Pntr. 619 Vert. Pntr. … … Vert. Pntr. Vert. Pntr 700 Vert. Pntr. 500 717 675 746 627 345 617 251 312 394 502 722 680 748 642 269 346 618 400 316 598 800 730 700 658 619 280 377 410 318 FREE FREE FREE FREE FREE FREE FREE FREE 327 449 FREE 469 Control Interval Split Control Interval Split VSAM Index Set 800 Vert. Pntr. Sequence Set Sequence Set Sequence Set Sequence Set Horiz. Pntr. Horiz. Pntr. Horiz. Pntr. FREE FREE Control Area Control Area Control Area Control Area Control Area Split