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:
1. ESDS: Entry Sequence Data Set.
2. KSDS: Key Sequence Data Set.
3. 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.
1. ESDS: It contains the files which are interface specific and accessed through Relative Byte Address.
2. KSDS: It contains the files which are interface specific and accessed through a secondary index.
3. RRDS: It contains the files which are interface specific and accessed through Relative Record Number.
- Each file has two objects.
1. File object:
- It represents the file itself.
- The methods of the file are used to perform DELETE,READ,REWRITE,UNLOCK,WRITE,STARTBR operations.
2. FileBrowse object:
It 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 -
command set (like DELETE, DEFINE etc..)
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.
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/O.
- 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 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) -
RECORDSIZE(100 150) -
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.
- 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 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: Step 2:
IF LASTCC =8 ; SET MAXCC=0
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.- 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.
- The VSAM information is stored in catalogs. The NON-VSAM information is stored in VTOC as dataset labels.
- 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.
What is the purpose of the VERIFY function of IDCAMS?- To re-sync the end of the file information with the catalog information, the VERIFY function is used.
What are the different dataset organizations used in VSAM?- VSAM stands for Virtual storage access method and it has three datasets organizations that are currently present.
- They are as follows:
- In this the access method is sequential that means the accessing of the data can be done sequentially.
- The data can be added from one side and removed also from one side in a sequential manner.
-vIn this the entries are indexed and according to the indexing only the accessing will be made available to the datasets that are used in the organization of VSAM.
-The indexed consists of keys that are used to uniquely identify the data that are provided for the use.
- In this the data can be accessed in a direct way or it can be said that there is no restriction on how the data can be retrieved.
- Any data can be called anytime and used.
What are the advantages of VSAM over ISAM?- VSAM replaced the indexed Sequential Access Method of ISAM and made it more popular and easier to use.
- VSAM is used in mainframe computers in large number than ISAM and it has done the installations in the computer to organize the data and make an easy access to it as well.
- VSAM datasets are made in catalogs using the integrated catalog facility structure which has never been provided with ISAM.
- VSAM records are arranged using the index key by using the method of relative byte addressing that are not used in ISAM and it is not even provided the way to do the accessing of the records using the index key.
How is record management performed in VSAM?- The record management function in VSAM is used for the application that is used to maintain the records and the dataset.
- There are different organizations in VSAM that is used to maintain the records of the datasets.
- These organizations are:
KSDS (Key-sequenced dataset): This stores the data in a sequential form using the keys that are unique for everyone.
ESDS (Entry-sequenced dataset): This keeps the data according to the entry in the order of their arrival.
RRDS (Fixed-length relative record dataset): This is having the fixed length relative record dataset that is used to keep the records in a fixed length.
VRRDS (Variable-length relative record dataset): It consists of variable length data records.
LDS (Linear dataset): This is same as sequential dataset that are used to show the linear way of representing the dataset.
What is the purpose of control intervals in VSAM?- Control intervals are used to store the data sets of three types.
- These are stored in groups and the control intervals allow the size of the groups to be controlled according to the optimization size.
- To optimize the size the record length and type the disk device will be used.
- The maximum size of a control will be used is 32,768 bytes.
- This interval consists of one or more data records that are specified the total number of control intervals that are used within the control area. - VSAM sees the addresses that are present using the relative byte address and it starts the displacement the start of the data set.
- There are different types of records that are present in VSAM includes:
1. Logical record:
They are the records that are present logically in the database and user doesn't have any information about it.
2. Physical record:
They are the records that are seen by the users.
What are the building blocks used in VSAM datasets?The VSAM datasets consists of logical records that provides more functionality to the whole database structure. This is used as a device dependent dataset that is provied by the system . This logical records consists of a control interval that is used to control the information transfer from one system to another system. The control interval consists of the logical records, the unused space that is also known as the free space that is provided to incorporate more programs accordingly, and the control information that is used to control the flow of the information from one system to another system. This control information will have two fields that are control interval defintion field that is used to control the information's interval and another is known as Record definition fields with the logical records.
What is the function of entry sequenced data set?The function is to identify the data set and make it accessible for the specification of the physcial location to be done. This specifies the byte address of each data set in record and show the relationship in the beginning of the dataset. This allows easy maintainance of the records and that is also in sequential order. The datasets can be accessed by defining the physcial location where the cluster data is stored in the order of entry. The record in the type of data set is relative to the byte address that is why it is not possible in this cases to delete the records. It is possible to add the record in this kind of dataset.
What is the main function of key sequenced data set in VSAM?The main function of key sequenced data set is to use each record method and check where it is located for accessing. This specify the key value and the unique sequence of the characters that are present in each record. It allows the accessing to be more easier and the record to be maintained using the value that are provided along with the data. It will consist of the components that is index component that will consist the entry of each file unique with the same number of characters for each record and data component that will keep the list of the key values of the records that are already present in the cluster. The maintainance is performed using the pointers and it also possible to organize it manually.
What is the purpose of relative record data set used in VSAM?This is the data set in which records are identified and accessed by a specific number of records that are relative to the first record in the dataset. It allows the accessing to be performed in randcom order and it also has only one component that is data component that can be used to keep the data in a linear manner. This method only supports fixed length records. This record is specified before any accessing of the list of record can be performed. The maximum number of records that can be contained in the dataset depends on the record posisiton of the data. It has both sequential and random accessing of the records and provides clustering of the data. This helps in maintaining the disk records that can be used later in maintainance of the data sets.
Why is master catalog used in VSAM?Master catalog is used to see all the files that are controlled by it. There are lots of attributes of the files that are used like password, authentication, and authorization of the files. It also used to monitor the files to check for the space that is available and maintain the master catalog. The attributes of the files are updated and maintained with the change in the information and keep always the current content and information. The operations that are perfomed using the file are done in a secure manner. There can be some operations like open() and close() that can be performed on the user's request to create the catalog more secure. The entries in this catalog consists of all the operations of the system and management techniques.
What is the main purpose of having user catalog in VSAM?The user catalog consists of the lower hierarchy of the catalog, that contains the same structure as the master catalog. It is used to enhance the security of the user point of view and keeps all the files pointed towards the master files. The master catalog points to the user catalog that is defined and points to VSAM files. There is a possibility that user catalog can be represented in any number of instances rather than having only one instance like master catalog. The structure of VSAM is given such that if any link is deleted it will delete the master catalog as well. The affect will only be on the master catalog and the user catalogs won't be affected. If the user catalog is destroyed the file under the catalog will also be destroyed.
What is the purpose of having VSAM data space?VSAM data space is an area where the direct access to the entire volue is given. It is possible to occupy the portion or the volume that is defined in the catalog. When the space allocation is specified then VSAM takes the full control of it. It maintains the space that is needed by the VSAm files. This files are defined using virtual tables. The master cluster or the user catalog allows new data space to be created to hold the user catalog entries. This consists the amount of space that is required for the user catalog. Master catalog consists of the pointer to the user catalog and allow all the data set to be joined together or have a relationship between them. The user catalog has higher level of qualifies that is same as the name of user catalog.
What is the use of Access method services in VSAM?
- Access method services are used to load the VSAM data set by using the structure that is given.
- AMS enable the detailing to be done using the data set entires that are given as name, organization type, record length, key location and password.
- It is used to produce the physical characteristics of the data set that the program should not supply with the detailed information about the program to access the ISAM file.
- The catalog of AMS is structured using VSAM model like:
STEP EXEC PGM=IDCAMS
- It includes many data entries that DEFINE the data set.
- The group under the cluster provide the data that are optional to be maintained in the data set.
- The DATA field creates an entry for the data component that is connected in the control area.
- The data component that is used consits of data records that are not indexed.
What is the function of Linear dataset in VSAM?Linear dataset consists of byte-addressable strings that are used in the virtual storage. VSAM dataset is used to have control interval of the size 4096 bytes. There are no boundaries i.e. The embdded control information is not looked in the logical records that can be locked or unlocked for the application program. The program that don't exist are from VSAM. The linear dataset consists of data component only. It is used to store the data set in linear fashion that allows the record to be submitted before taking a copy of it.
What makes VRRDS different from VSAM?VRRDS (variable relative record data set) : is used as an alternative index that is provided with the base cluster. It uses an alternate key in each record. It uses an unique key that is always take the alternate keys. The base cluster can also consists of many alternate indexes. The path that is defined in this uses an alternate index for the data set that has to be inserted. This cluster is having the paths opened to provide the access to all the dataset that are present with different logical keys. The alternate index can be processed as a dataset without using any other mechanism just by using the component of a path. There are few upgrade set that are used to set the base cluster for the alternate indexes and it need to be updated everytime there is a change in the data set.
How does control Intervals and control Areas related to each other?The control interval is the basic unit of information that is used by VSAM. It resides between the main storage and peripheral storage to provide easy access to the data set. It has a defined set that is been given by the system and all the datasets are also of the same size so that it will be easier to use it and implement it. The size of the control interval is in between 512 and 32,768 bytes and it always comes in multiple of 512, or of 2048. It is always necessary to keep the size higher due to the control interval size which can be greater than track size. The control areas consists of logical records, unused space, and control information that is provided for the reusability and to implement the correct record size.
What are the access method services used in VSAM?There are many utility programs that are used to create and maintain the VSAM catalogs. This catalog consists of data spaces that is required by all the data sets and use of data sets to provide the storage container for the data arriving. IDCAMS is used just for this purpose to handle the request of the user and provide simple commands to keep the association with other parameters. Access method services allow easy to access services without doing hard core programming and easy to use interface so that user can fill the data and use many dataset functions.
What are the steps involved in access method services?
- There are few steps that has to be followed to activate the use of access method services on the computer.
- The first steps is to execute the IDCAMS utility program that provide data spaces, data sets and other defined parameters to support the easy handling of the request.
Calling of IDCAMS from some other computer using the compatible program so that the integrated functionality can be activated that helps in maintaining different catalog facility catalogs.
- The example shows the function of IDCAMSas:
//VDFNDEL JOB 1,LINDAJO,MSGCLASS=X
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD *
//SYSIN DD *
DEFINE CLUSTER (NAME (LINDA.DATA.VSAM) -
VOLUMES(WORK02) CYLINDERS(1 1) -
RECORDSIZE (72 100) KEYS(9 8) INDEXED)
REPRO INFILE(DATAIN) OUTDATASET(LINDA.DATA.VSAM) ELIMIT(200)
- Execution of AMS (access method services) commands that comes under time sharing options that gives the dataset to execute and access the services provided using easy to use interface.
What are the different parameters that are used in VSAM?There are different parameters that are used to provide VSAM services like:Positional parameters that are required to be coded to be used as a pre-defined sequence that allow many parameters to be used and managed for which the position is changing. The appearance should be visible for all the parameters that are coming before any keyword.
Keyword parameter is prefixed by a keyword that defines the meaning of any parameter that is used. It can be coded in a particular sequence by seeing all the positional parameters. It has a particular form of a list that uses all the subparameters as well.
Sub-parameter: is always contained inside a parameter and used only when it is required. The sub-parameters use separators to separate themselves from the actual parameters.
Why is it required to have a Keyed directed retrieval?Key sequenced data sets provide the use of both sequential and direct processing of the data sets by the use of a unique key. The direct processing require to supply VSAM with the defined key that allows the record to be accesed. The keys can be used to access indirectly but it should be of the same length as the keys that are given in the data set. The key should exist in the data set. It uses the following functions of KEY and CLUSTER to arrange the keys in the program. There is given a program through which the records can be accessed directly. The user can enter the records from the terminal and the program displays the record on the screen. This consists of the 4-byte KEYFIELD that is used to specify the requirement for the ACB, RPL and GET macros that are used to update the changes that are produced.
How is the sorting of VSAM files carried?
- The sorting of the VSAM files or records can be done either in asending sequence or descending sequence.
- There is a use of DEFINE CLUSTER that allocated the data set to the NON-INDEXED location for the sorting to take place.
- The result will be generated in the sorted format of the data set.
- The sorting specification is as followed:
// EXEC SORT,SIZE=256K
- This is the program that is used to sort the program and load it to the storage for execution purpose. The sort SORT FIELDS defines the fields that has to be sorted. The above program explains that the major sort field begins in position 1 that is 4 bytes long and it is in character (CH) format. Then it defines the sorting order by ascending (A) sequence.
The minor sort field starts with the position 9 and it is also 4 bytes long. This is packed (PD) format and gets sorted in descending (0) order.
Sort utility can be used to sort in an easy way without the knowledge of the program.