IBM MAINFRAMES VSAM TRANING CLASS 01 Traditional Access
IBM MAINFRAMES VSAM TRANING CLASS -01
Traditional Access Methods An access method defines the technique by which data is stored and retrieved. § § QSAM (Queried Sequential Access Method) BSAM (Basic Sequential Access Method) for ‘flat’ files ISAM (Index Sequential Access Method) for Index files BDAM (Basic Direct Access Method) for direct access files
What is VSAM? § VSAM stands for Virtual Storage Access Method § It is a method used to move data between Disk and Main Storage § VSAM operates in Virtual Environment § VSAM acts as interface between Operating System and Application Program Application Request V S A M Reply Operating System
Cluster § § § VSAM datasets are defined as Clusters. A Cluster is a combination of the data component and the index component. The data component holds data records. The index component holds the index records to access the required information from the data component The Index component is applicable only in the case of a KSDS. Data Component (CA 2) Highest Index Set 2210 5000 1055 1600 FS 5000 FS 1010 1055 FS 1350 1600 DATA COMPONENT (CA 1) 1005 1010 FS 1300 1305 1310 1350 FS 1020 1022 1030 1055 FS 1400 1415 1600 FS FS FS F S Sequence Set 1001 1002 FS FS
VSAM Dataset Types Entry Sequenced Dataset (ESDS) contains records in the order in which they are entered. Records are added to the end of the data set, and can be accessed sequentially by a relative byte address (RBA - relative position of the record from the beginning of the dataset). Key Sequenced Dataset (KSDS) contains records in ascending collating sequence. Records can be accessed by a field called a key, or sequentially. Relative Record Dataset (RRDS)contains records in the order of relative record number. These records can be accessed only by this number. Linear Dataset (LDS) contains data that has no record boundaries.
Control Interval Logical Record § Logical records of VSAM data sets are stored in a different manner from logical records in non-VSAM data sets. VSAM stores records in control intervals. Control Interval (CI) A control interval consists : § § § Logical records (LR) Free space (FS) Control information DF & RDF Free Space is the space reserved within the CI for inserting new records in a KSDS or for lengthening the existing records.
Control Area § § CIs are grouped into CA § A VSAM data set is actually composed of one or more control areas. The maximum size of a control area is a cylinder, and the minimum size is one track. The control intervals in a VSAM data set are grouped together into Control Areas. LR LR. . FS. . . RDF CIDF LR LR. . FS. . . RDF CIDF
Control Interval Split § § When a data set is first loaded, the key sequence of records and their physical order are the same. However, when records are inserted, control interval split can occur, causing the data control intervals to have a physical order that is different from the key sequence. For example, try to insert '1004' in CI-1 shown below : A Control Interval Split occurs and CI-1 is split exactly into two half CI's. CI-3, which is a free control interval is used, and some logical records of CI-1 are moved into CI-3 is placed after CI -2 and it is not inserted in between CI-1 and CI-2. CA-1 (CI-1 to CI-3) - Before split 1001 1002 1005 1010 FS 1020 1022 1030 1055 FS FS FS CA-1 (CI-1 to CI-3) - After split 1001 1002 1004 FS 1020 1022 1030 1055 1005 1010 FS FS FS
Control Area Split § Now, if record ‘ 1025’ is inserted, there is no free control interval for a CI split to occur. Hence, a CA (control area) split occurs. The CA-1 is split into two half control areas; some of the Control intervals of CA-1 are moved into the newly created CA (CA-2). 1001 1002 1004 FS 1020 1022 FS FS FS 1025 1030 1055 FS 1005 1010 FS FS CA-1 (CI-1 to CI-3) - After split CA-2 (CI-1 to CI-3)
Access Method Services (AMS) § Access Method Services is a service program that helps you to allocate and maintain VSAM data sets and catalogs. § IDCAMS is the name of the utility program used to perform the following operations on VSAM data sets. § Creating a Data set § Loading a VSAM data set. § Printing a Data set § Deleting a Data set § Error Detection for KSDS Data set § Creating Generation Data Groups (GDG) etc.
Organization & Access Mode Options The following keywords have to be used to define the different types of VSAM data sets: NONINDEXED NUMBERED LINEAR for ESDS. for KSDS. for RRDS. for LDS. ESDS : SEQUENTIAL KSDS : SEQUENTIAL or RANDOM or DYNAMIC RRDS : SEQUENTIAL or RANDOM or DYNAMIC SEQUENTIAL => ESDS INDEXED => KSDS RELATIVE => RRDS
Defining a VSAM Cluster § The Define Cluster command is used to allocate VSAM data sets. The basic information required for defining a VSAM data set is: § § § Name of the cluster. § § § Record size, and whether it is fixed or variable in length. Volume(s) on which the data set will be allocated. Type of data set (KSDS, ESDS, RRDS or LDS). Space needed for the data set. For a KSDS, the length of the key and its offset from the beginning of the record. Control interval size. CI and CA Free Space.
Sample JCL to create an ESDS cluster //FSS 197 EX JOB MSGCLASS=Q, NOTIFY=&SYSUID //DEFESDS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER(NAME(FSS 197. TEST. ESDS) VOLUMES(S 7 SYS 1) - NONINDEXED - TRACKS(2, 1) - RECORDSIZE(50, 50) - CONTROLINTERVALSIZE(4096) - FREESPACE(10, 20)) - DATA(NAME(FSS 197. TEST. ESDS. DATA)) /*
ESDS Cluster § § § § Similar to Sequential File/Flat file (PS File). § Alternate Index is supported in on-line applications (CICS). Sequenced by the order in which data is entered/loaded. New Records are added at the end only. Supports both Fixed and Variable formats. Contains only CLUSTER & DATA components. Only sequential access in Batch Cobol Programs. Random access is supported in on-line applications (CICS) using Relative Byte Address (RBA).
CREATING ESDS
Writing Data in ESDS
Writing Data in ESDS
Writing Data in ESDS
RUNNING A PROGRAM
PRINT ESDS
Thank You
- Slides: 21