Iteanz Interview Questions | Latest Technologies Interview Questions

VSAM Interview Questions and Answers

Written by Nithyanandham | Sep 10, 2022 11:06:12 AM

Q1. What is meant by VSAM?

Ans: VSAM (Virtual Storage Access Method ) is an access method for IBM's mainframe operating system, MVS, now called z/OS. VSAM succeeded and expanded upon an earlier IBM file access method, ISAM (Indexed Sequential Access Method).

Q2. What is the use of alternate index in VSAM?

Ans: VSAM - Alternate Index. Advertisements. Alternate index are the additional index that are created for KSDS/ESDS datasets in addition to their primary index. An alternate index provides access to records by using more than one key. The key of alternate index can be a non-unique key, it can have duplicates.

Q3. What is the use of JCL in mainframe?

Ans: JCL (job control language) is a language for describing jobs (units of work) to the MVS, OS/390, and VSE operating systems, which run on IBM's S/390 large server (mainframe) computers. These operating systems allocate their time and space resources among the total number of jobs that have been started in the computer.

Q4. What is the catalog?

Ans: The catalog contains the names of all datasets, VSAM and non-VSAM. It is used to access these datasets.

Q5.  What are the different types of VSAM files available?

Ans: ESDS: Entry Sequence Data Set
KSDS: Key Sequence Data Set
RRDS: Relative Data Set

Q6. What is Control Interval, Control Area ?

Ans: Control Interval is analogous to a physical block for QSAM files. It is the unit of i/o. Must be between 512 bytes to 32 k. Usually either 2K or 4K. A larger control interval increases performance for sequential processing while the reverse is true for random access. Under CICS when a record is locked, the entire CI gets locked.
Control area is a group of control intervals. CA is used during allocation. CA size is calculated based on the allocation type (cyl, tracks or records) and can be max of 1 cylinder

Q7. What is Upgrade and Noupgrade option in Alternate Index?

Ans: UPGRADE specifies that the alternate index should be modified if the base cluster is modified and NOUPGRADE specifies that the alternate indexes should be left alone if the base cluster is modified.

Q8. What is free space?

Ans: Free space is reserved within the data component of a KSDS to accommodate insertion of new records.

Q9. What is the use of ALTER command in VSAM?

Ans: ALTER command is used to change most of the VSAM dataset attributes that were specified while defining VSAM cluster.

Q10. What does a file status of 02 on a VSAM indicate?

Ans: Duplicate alternate key . Happens on both input and output operation

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

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

Q12. Would you specify FREESPACE for an ESDS?

Ans: 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 freespace does not make any sense.

Q13. What is SHAREOPTS ?

Ans: SHAREOPTS is a parameter in the DEFINE and specifies how an object can be shared among users. It is coded as SHAREOPTS(a b), where a is the cross region share option ie how two or more jobs on a single system can share the file, while b is the cross system share option ie how two or more jobs on different MVSes can share the file. Usual value is (2 3).

 Q14. What happens when you open an empty VSAM file in a COBOL program for input?

Ans: A VSAM file that has never contained a record is treated as unavailable. Attempting to open for input will fail. An empty file can be opened for output only. When you open for output, COBOL will write a dummy record to the file & then delete it out.

Q15. What are Unique Cluster?

Ans: Unique Clusters consists of a separate data space which is utilized completely by the cluster created within it. Unique clusters are created out of unallocated space on direct access storage.

Q16. What are Sub-allocated Clusters?

Ans: A sub-allocated VSAM file shares the VSAM space with other sub-allocated files. It specifies that file should be sub-allocated within existing VSAM space. Sub-allocation is used for easier management and control of VSAM spaces.

Q17. How do you define a GDG ?

Ans: Use the DEFINE GENERATIONDATAGROUP command. In the same IDCAMS step, another dataset must be defined whose DCB parameters are used when new generations of the GDG are created. This dataset is known as the model dataset. The ds name of this model dataset must be the same as that of the GDG, so use a disp of keep rather than catlg and also specify space=(trk,0)

Q18. How do you calculate record size of an alternate cluster? Give your values for both unique and non-unique.

Ans: Unique Case: 5 + ( alt-key-length + primary-key )
Nonunique Case: 5 + ( alt-key-length + n * primary-key )
where n = # of duplicate records for the alternate key
????Any one who knows - can you explain ?

Q19. What is the difference between sequential files and ESDS files?


Sequential(QSAM) files can be created on tape while ESDS files cannot.
Also, you can have ALTINDEX for an ESDS while no such facility exists for QSAM files

Q20. What is IDCAMS ?

Ans: IDCAMS is the Access Method Services program. You run the IDCAMS program and supply AMS commands thru SYSIN. (examples of AMS commands are DELETE, DEFINE, REPRO etc..).

Q21. Can AMS commands be run from the TSO prompt ?

Ans: Yes

Q22. Syntax of AMS modal commands ?

Ans: Note: these can be used only under IDCAMS and not from the TSO prompt.

IF LASTCC(or MAXCC) >(or <,= etc..) value -
THEN -
DO -
command set (such as DELETE, DEFINE etc..)
ELSE -
DO -
command set
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

The maximum condition code is 16. A cond code of 4 indicates a warning. A cond code of 8 is usually encountered on a DELETE of a dataset that is not present.

Q23. Under IDCAMS , multiple functions can be executed, each of which returns a cond code. What will be the condition code returned to the operating system ?

Ans: The maximum condition code generated is returned as the condition code of the IDCAMS step