JCL

VSAM Interview Questions with Answers

The VSAM interview questions and answers are intended for those with a working knowledge of VSAM as a programmer. This will help you prepare for technical VSAM interview and online selection tests during campus placement for freshers and job interviews for professionals.

VSAM Interview Questions with Answers

1. What is a control interval, control area, cluster & alternate index?

Answer: Control Interval: A control interval is the unit of information that VSAM transfers between virtual and auxiliary storage. A control interval range must be 512 bytes to 32 KB, preferable 2 KB or 4 KB as Control Interval with larger space will increase the performance for sequential processing but on contrary, the reverse is true for random access.

Control Area: A group of control intervals makes up a control area. The number of control intervals for each control area depends on the reserved space at the time of dataset creation.

Cluster: A cluster is the combination of the index, sequence set and data portions of the dataset. The operating system gives program access to the cluster that is to all parts of the dataset simultaneously.

Alternate index: An alternate index is a file that allows access to a VSAM dataset by a key other than the primary one. IDCAMS utility with the DEFINE AIX option after you build the cluster and then do another IDCAMS with the BLDINDEX option to populate the alternate index.

2. Do primary key values and alternate key values have to be unique?

Answer: Primary key values must be unique and alternate key values need not be unique.

3. What do you think will be the output if an empty VSAM file is opened in a COBOL program?

Answer: Opening a VSAM file that has no record in it is not possible. It will become unavailable for the user trying to do so. Rather, an empty file can be opened for the purpose of some outputs. COBOL will write a dummy record in the file and delete it when a user opens it for some output.

4. What Is Buffering And How Does It Apply To VSAM Files ?

Answer: When large blocks of data are used, more main storage is required than when smaller blocks are used, but large blocks save CPU time and disk space. Additionally, extra buffers may save elapsed time since the program does not have to wait for an I/O to complete for it to continue processing.

  • In the JCL, you specify BUFNI (number of index buffers) and BUFND (number of data buffers) as sub parameters of the AMP parameter.
  • For random access, the BUFNI is one more than the number of index levels and a BUFND of 2 is fine.
  • For sequential access, a BUFNI of 1 and a minimum of 5 for BUFND is fine.
  • For dynamic access, the values of each is the higher of the numbers for either random or sequential.

5. How Do You Define A KSDS?

Answer: DEFINE CLUSTER(cluster name) with the INDEXED parameter. Also specify the ds name for the DATA component & the ds INDEX component. Other important parms are RECORDSIZE, KEYS, SHARE OPTIONS.

6. What are the IDCAMS commands that can be used for VSAM and explain each of those commands?

Answer: ALTER is used for modification of information for a catalog, alternate index, cluster or path.

BLDINDEX is used to build the alternate index.

DEFINE is used for ALTERNATEINDEX, CLUSTER or PATH.

DELETE is used to remove the catalog entry for a catalog, cluster, alternate index or path.

LISTCAT is for listing Information about the Dataset.

PRINT is used to print the Dataset contents.

REPRO is used to copy records from one file to another.

7. What is the purpose of the VERIFY function of IDCAMS?

Answer: To re-sync the end of the file information with the catalog information, the VERIFY function is used. E.g. during processing of a VSAM file, some system error occurs and it is subsequently unusable then run VERIFY to correct this issue.

8. What are the different dataset organizations used in VSAM?

Answer: VSAM stands for Virtual storage access method and it has three datasets organizations that are currently present. They are as follows:

Sequential: 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.

Indexed: In 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.

Direct-access: 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.

9. What are the advantages of VSAM over ISAM?

Answer: 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.

10. What is the purpose of control intervals in VSAM?

Answer: 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:

Logical record:

They are the records that are present logically in the database and user doesn’t have any information about it.

Physical record:

They are the records that are seen by the users.

11. What is the function of entry sequenced data set?

Answer: The function is to identify the data set and make it accessible for the specification of the physical 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 maintenance of the records and that is also in sequential order. The datasets can be accessed by defining the physical 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.

12. What is the main function of key sequenced data set in VSAM?

Answer: 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 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 maintenance is performed using the pointers and it also possible to organize it manually.

13. What is the purpose of relative record data set used in VSAM?

Answer: 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 random 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 position 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 maintenance of the data sets.

14. What is a VSAM split?

Answer: If there isn’t enough space in the control interval VSAM performs a control interval split by moving some records to the free control intervals.  If there isn’t a free control interval VSAM performs a control area split by allocating a new control area and moving half of the control intervals to it.

15. What’s a LDS (Linear Data Set) and what’s it used for?

Answer: LDS is a VSAM dataset in name only. It has unstructured 4k (4096 bytes) fixed size CI’s which do not contain control fields and therefore from VSAM’s standpoint they do not contain any logical records. There is no free space, and no access from Cobol. Can be accessed by DB2 and IMS fast path datasets. LDS is essentially a table of data maintained on disk. The ‘table entries’ must be created via a user program and can only be      logically accessed via a user program. When passed, the entire LDS must be mapped into storage, and then data is accessed via base and displacement type processing.

16. Describe the uses of AMS?

Answer: Access Method Services are used to easily load all the VSAM data using the structure that is fed while creating. It enables one to add as many details as possible. The interface is simple and one can define the dataset using plenty of data entries. Also, there are data fields provided that can be directly connected to the control area.

17. Discuss record management in VSAM?

Answer: To maintain all the records and the dataset, record management is used. There are few organizations within VSAM that perform these activities.

  • KSDS is key-sequenced data set that stores data in a sequence with reference to the keyword.
  • RRDS is fixed length relative record database which keeps all the records with a fixed length.
  • VRRDS is variable length relative record database and it stores data records of various lengths.
  • LDS is linear dataset and this stores data in a linear way with reference to the keyword.

18. Why CI and CA splits are not possible in ESDS and RRDS?

Answer: In ESDS the new record is added at the end of last record. And no embedded free space is allocated at the time of Dataset definition. In the case of RRDS the slots for the records are pre-allocated and so the CI and CA split is not possible.

19. Explain the meaning and syntax for the START command?

Answer: In VSAM, the START command is used to read other than the next VSAM record. For this, A value must be moved into the RECORD KEY. However, the KEY clause is optional, but it can be used to specify a relational operator.

20. What do you mean by the REPRO command?

Answer: Whenever a new cluster is created using IDCAMS, the cluster will be empty. By the use of REPRO command, we are able to load records into the cluster. REPRO is used to:

  • Copy Datasets (VSAM or NON-VSAM), copy catalogs.
  • Conversion of sequential and index sequential Datasets to VSAM format.
  • Backup VSAM catalog
  • Conversion of VSAM and Index sequential Datasets to sequential format
  • Read a backup copy of VSAM catalogs.

21. Can you tell me what are the codes returned by the AMS (Access Method Services) command during the execution in VSAM?

Answer: Every AMS command issues a condition code. If multiple commands are being executed successively, there might be a requirement to execute or bypass certain commands on the Success or failure of a previous command. The normal condition codes returned by AMS commands are:

  • 0 – The function was executed successfully
  • 4 – A problem was encountered while executing the function, WARNING
  • 8 – The requested function was executed, but major specifies were unavoidably bypassed, ERROR
  • 12 – The requested command could not be performed because of a logical error, SEVERE
  • 16 – A severe error occurred causing the remainder of the command stream to be bypassed. FATAL.

22. Explain what do you mean by buffering and how does it apply to VSAM files.

Answer: When there are large blocks of data that are to be used, more main storage is required than when smaller blocks are used, but one advantage of large blocks is that it save CPU time and disk space. Moreover, extra buffers may save elapsed time since the program does not have to wait for an I/O to complete for it to continue processing.

In JCL, you specify BUFNI (number of index buffers) and BUFND (number of data buffers) as

Sub-parameters of the AMP parameter.

  • For random access, the BUFNI is one more than the number of index levels and a BUFND of 2 is fine.
  • For sequential access, a BUFNI of 1 and a minimum of 5 for BUFND is fine.
  • For dynamic access, the values of each is the higher of the numbers for either random or sequential.

23. Explain in brief what is the difference between ESDS and KSDS in VSAM?

Answer: ESDS doesn’t have imbedded free space. The KEYS parameter has no meaning in the context of ESDS. ESDS has no index component. An additional parameter, NONINDEXED is used to tell AMS that an SDS is being allocated.

24. Can you explain how LDS is different from ESDS in VSAM?

Answer: An LDS is a data set; very similar to an ESDS without the control information .It has no records and used for fast random access. It takes advantages of the computer’s very fast paging hardware for retrieval and storage and the bytes are implicitly divided into 4K blocks or pages, and the paging hardware reads and writes blocks from disk. There is no free space, unused space, control field in LDS.

25. Can we access records in VSAM only by a single Key, i.e. primary Key?

Answer: Yes, it is also possible to access the records in a sequence other than that of the primary Key. Such Keys are called alternate Keys and they can be non-unique. For Instance, in a pay-roll system where employee number is the unique primary Key and the Employee name as alternate Key.

26. How do you decide on optimum values for CI, FREESPACE etc?

Answer: CI size should be based on record length, type of processing. Usually CI is 4K. If record length is larger (>1K), chose 6K or 8K. FREESPACE should be large if more number of insertions are envisaged. Usual values are (20 20) when heavy updates are expected. CI size can be calculated.

27. Would you specify FREESPACE for an ESDS?

Answer: No. Because you cannot insert records in an ESDS, also when you rewrite a record, it must be of the same length. Thus putting any value for free space does not make any sense.

28. Is it slower if you access a record through ALT INDEX as compared to Primary INDEX?

Answer: Yes, because the alternate key would first locate the primary key, which in turn locates the actual record. Needs twice the number of I/Os.

29. Why is free space left in KSDS Dataset?

Answer: While allocating KSDS Datasets, free space is declared at regular intervals at the time of initial loading. This is done because this free space is utilized for keeping the data arranged in sequence physically, even though inserted randomly

30. How do you load a VSAM data set with records?

Answer: Using the REPRO command

Read JCL blogs : Click Here SYNCSORT : Click Here

Admin

Share
Published by
Admin

Recent Posts

Increase Transparency and Collaboration Product Backlog

A well-maintained product backlog is crucial for successful product development. It serves as a single…

5 days ago

Product Backlog – Incremental value to the customer

Incremental value to the customer refers to the gradual delivery of small, functional parts of…

7 days ago

Product Market, Customer’s Desire, Need, and Challenges

A Product Market refers to the group of potential customers who might be interested in…

1 week ago

PAL-EBM Professional Agile Leadership – EBM Certification

The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…

3 months ago

PAL I Professional Agile Leadership Certification

The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…

4 months ago

Scrum Master Certification: CSM, PSM, SSM

Choosing the right Scrum Master Certification depends on your current experience and career goals. If…

5 months ago