What are the different types of VSAM files available? Explain them
Virtual Storage Access Method(VSAM) is a disk storage system.It was implemented in OS/VS2 operating system.
Subsequently, it was used through out the MVS architecture.
VSAM comprises of the following access methods:
ESDS: Entry Sequence Data Set
KSDS: Key Sequence Data Set
RRDS: Relative Data Set
VSAM records can be of fixed or variable length.
These are organized in fixed size blocks, known as Control Intervals, and later into larger divisions known as Control Areas.
CI sizes are measured in terms of bytes, while CA sizes are measured in terms of disk tracks or cylinders.
ESDS : It contains the files which are interface specific and accessed through Relative Byte Address
KSDS : It contains the files which are interface specific and accessed through a secondary index
RRDS : It contains the files which are interface specific and accessed through Relative Record Number
Each file has two objects.
1. File object - represents the file itself. The methods of the file are used to perform DELETE,READ,REWRITE,UNLOCK,WRITE,STARTBR operations.
2. FileBrowse object - represents a browse operations on the file and the methods are used to perform ENDBR,READNEXT,READPREV,RESETBR
What is the syntax of AMS modal commands?
The following is the syntax of AMS modal commands:IF LASTCC(or MAXCC) >(or <,= etc..) value -
THEN -
DO -
command set (like DELETE, DEFINE etc..)
ELSE -
DO -
command set
where
LASTCC - Condition code from the last function(such as delete) executed
MAXCC - Max condition code that was returned by any of the prev functions
SET is also a valid AMS command. SET LASTCC (or MAXCC) = value
PS: These can be used only under IDCAMS and not from the TSO prompt.
b.) What is the maximum record length for the VSAM dataset?
The maximum size of a VSAM record is 1 Cylinder.
What is Control Interval, Control Area?
Control Interval:Control Interval is similar to the physical block for QSAM files. It is represented as the unit of I/). A control unit's range must be 512 bytes to 32 KB. It is preferable to use either 2KB or 4KB.
Control Interval with larger space will increase the performance for sequential processing. On contrary, the reverse is true for random access.
Control Area:
Control Area is a group of control intervals.
The way of filing the control area is similar to that of control interval
The number of control intervals for each control area depends on the reserved space at the time of dataset creation.
How do you define an ALTINDX ? How do you use ALTINDXs in batch, CICS programs?
a.) Issue the command DEFINE ALTERNATEINDEX. Important parameters are RELATE where the database cluster name is specified.KEYS, RECORDSIZE,SHAREOPTIONS,UNIQUEKEY(or NONUNIQUEKEY)
DATA(data source name for the data component), INDEX(data source name for the index component).
b.) Then issue the command DEFINE PATH.
Important parameters are NAME (data source name for the path),
PATHENTRY (data source name of the alternate index name),
UPDATE or NOUPDATE, that specifies the determination of alt index is updated when an update to the database cluster occurs
c.) Then issue the command BLDINDEX.
Important parameters are INDATASET (data source name of base cluster), OUTDATASET(data source name of AIX).
Using alternate indexes in batch programs:
JCL, has DD statements for cluster and for paths.
For the COBOL program :
The command SELECT ASIGN TO ddname For the base cluster RECORD KEY IS… ALTERNATE RECORD KEY IS… used
Using alternate indexes in CICS programs:
The creation of FCT entries are mandatory for both cluster and the path
Utilize the dd name of the path in CICS file control commands, by using the alternate index
We can define the KSDS cluster by two ways by using the file-aid or by using the IDCAMS Utility. Explain them.
KSDS cluster can be defined by-Using the file-aid
-or by using IDCAMS utility:
The record can be defined with average length of 100 and maximum length of 150, in IDCAMS, with key length 10 starting at 0.
The following example illustrates :
//step01 EXEC pgm=IDCAMS
//SYSIN DD *
DEFINE CLUSTER(NAME(userid.name.sample) -
VOLUMES(MVS801) -
RECORDSIZE(100 150) -
TRACKS(10 20)
KEYS(10 0) -
INDEXED ) -
DATA ( NAME(userid.name.sample.data)) -
INDEX( NAME(userid.name.sample.index)) -
/*
//
How do you convert flat files to VSAM files?
Flat files are converted into VSAM files by following process:- Identify the primary key, when the whole record can be primary key.
- Alternate key can also be used, if needed
- File is to be sorted by primary key or the whole record
- Utilize the SORT statement for dropping duplicates.
- A JCL command ( IDCAMS – Define Cluster) need to be submitted by using the result of sorting mechanism(mentioned above) as input
- Use the command IDCAMS REPRO for loading the flat file into the VSAM file.
What is the maximum record length for the VSAM dataset?
- The maximum record length for VSAM data set is 1 cylinder.- There can be SPANNED RECORDS that covers multiple CIs
- A Spanned Record can never cross a CA.
- The maximum value for a CA is 1 cylinder, so the VSAM record.
How do you define a GDG?
- The command DENFINE GENERATIONDATAGROUP is used for defining GDG- In IDCAMS, another dataset definition is mandatory, where DCB parameters are used when new GDG are created
- This data set is called as ‘Model dataset;
- The data set name must be the same that of the GDG
- Use a ‘disp’ instead of ‘catlg’ and specify the space=(trk,0)
What is a CI SPLIT ? What is a CA SPLIT ?
When the Control Interval does not have enough space, VSAM performs a split on CI by moving some of the records to the CIs that are free.In case of non-availability of free space, VSAM performs a control area split. This is done by new control area allocation and moving half of the CIs to it.
CI SPLIT :
- The movement of some records into another free CI in the same CA
- CI Split needs certain number of Input / Output operations. This leads to degradation of VSAM file
- The correct space is needed to allocate for CI
- The result is half-empty CIs on contrary to one full and one empty CI
CA SPLIT :
- CA Split is the process moving half of the records of one CA to a new CA
- The addition or deletion of records can not accommodate in the existing CA
- The result is two half-full CAs on contrary to one full and one empty CA
How did you refresh a VSAM file and how frequently you do it ?
- Refresh can be done on daily or weekly or monthly basis- Refreshing refers to DELETE / DEFINE the VSAM file
Step 1:
Deleting the existing VSAM file:
IF LASTCC =8 ; SET MAXCC=0
Step 2:
DEFINE VSAM-FILE(COND=(0,LT,STEP1)
Return-code = 8 when the file that is trying to delete does not exist.
Utilize the command VERIFY in TSO
Explain the information contained in CI
- Control information consists of Record Descriptor Field and Control Interval Descriptor Field.- Each CI contains one CIDF that consists of the last 4 bytes
- CIDF consists of information about the offset and length of free space in the CI
- In case of fixed size records, each CI contains 2 RDFs each RDF is of 3 bytes length
- In case of variable length size records, there will be a separate RDF for each record in the CI.
- The data portion of the CI should be in the multiples of 512 bytes / 2048 bytes.
- The maximum size of the CI is 32 KB.
- The size of index portion of CI could be any of these – 512, 1024,2048,4096
Explain the differences between VSAM and Non-VSAM files
1. - The AMS program is used for creation of VSAM files- ISPF panel or a standard JCL is used for creation of a NON-VSAM dataset.
2. - The VSAM information is stored in catalogs
- The NON-VSAM information is stored in VTOC as dataset labels
3. - The data set organization in VSAM files are Key sequenced, Entry sequenced and Relative record data sets
A data set is a physical records that are stored on a disk or tape , is a collection with a unique name
The data set is normally identified by the MVS with labels
The label information need to be supplied in JCL
- The data set organization in NON-VSAM files are sequenced, Indexed Sequential, Direct and partitioned
Difference between VSAM and Database Tables
1. -VSAM file can not run SQL queries. -VSAM lacks any kind of relation -VIEWS and SYNONYMS can not be defined on VSAM files -RDBMS concepts can not be applied in VSAM files.2. - SQL queries can be run in database table - Data fetching is more efficient than VSAM files - RDBMS concepts are applicable in DB2 database - ALIAS VIEWS can be defined on tables for sharing customized data.
What is meant by dirty read in VSAM?
- High degree of concurrent access to VSAM files is achieved by dirty read - It is done by avoiding the complications associated with CI and CA splits - The dirty read protocol is summarized as:- The VSAM file mandatorily be defined with cross-region SHARE POINTS 4. - The file allocation must be with DISP=SHR - ENQ must be followed for all operations of the files, for data set - Data set name is specified for ENQ name - Any string can be used for the ENQ gname - The user’s buffer must be refreshed with GET request, after obtaining a lock - No lock is held during a wait - DEQ function should be called at the end of all the file operations of enqueue.
What are the IDCAMS commands that can be used for VSAM and explain each of them.
- To modify the information for a catalog, alternate index, cluster or a path, ALTER command is used- DEFINE command is used for ALTERNATEINDEX, CLUSTER or PATH
- DELETE command is used for removing the catalog for a catalog, cluster, alternate index or path
- LISTCAT command lists the information about the dataset.
- PRINT command prints the contents of dataset
- REPRO command is used to copy the records from one file to another.
No comments:
Post a Comment