VSAM Interview Questions
VSAM Interview Questions
8. What is a 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, ie. to all parts of the dataset
simultaneously.
A path is a file that allows you to access a file by alternate index - the path provides an association
between the AIX and the base cluster.
The upgrade set is the list of all AIXes that VSAM must maintain for a specific base cluster, so that
when data in the base cluster is updated, the AIX files are also updated.
Free space is reserved within the data component of a KSDS to accommodate inserting new records.
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.
The base cluster consists of the data component and the index component for the primary index of a
KSDS.
16. Do primary key values have to be unique? Do alternate key values have to be unique?
Primary key values must be unique; alternate key values need not be.
17. In the COBOL SELECT statement what is the ORGANIZATION for a KSDS?
18. In the COBOL SELECT statement for a KSDS what are the three possibilities for ACCESS?
The RECORD KEY in the SELECT clause identifies the files primary key as it will be known to the
program.
20. What is the purpose of the FILE STATUS clause in the SELECT statement?
The FILE STATUS field identifies the field that VSAM uses to provide information about each I/O
operation for the file.
21. If you wish to use the REWRITE command haw must the VSAM file be opened?
22. Explain the meaning and syntax for the START command.
The START command is used read other than the next VSAM record. A value must be moved into the
RECORD KEY. The KEY clause is optional, but it can be used to specify a relational (equal, less than,
etc.) operator.
It's rarely used. It means one program uses both sequential and random processing for a VSAM KSDS
file.
They are end of file (10), duplicate key (22), record not found (23), VSAM logic error (90), open
problem (92) and space problem (93).
25. What is the VSAM-code field?
It is a COBOL II enhancement to VSAM batch processing expanding the FILE STATUS field. It is defined
in WORKING-STORAGE as a six byte group item with three two byte elements, the normal return
code, the function code and the feedback code.
A relative record dataset (RRDS) consists of a specified number of areas called slots. Each slot is
identified by a relative record number (RRN) which indicates its relative position in the file.
28. There are at least seven IDCAMS commands; name and explain each of them.
ALTER modifies information for a catalog, alternate index, cluster or path. BLDINDEX builds the
alternate index, ofcourse. DEFINE is used for ALTERNATEINDEX, CLUSTER or PATH. DELETE removes
the catalog entry for a catalog, cluster, alternate index or path. LISTCAT lists information about the
dataset. PRINT prints the dataset contents. REPRO copies records from one file to another.
29. What are the three levels of definition for the VSAM DEFINE?
It specifies how the file may be shared between jobs and between batch and CICS environments.
It specifies whether Daniela Pestova or Yamila - oops! Wrong models! The MODEL parameter allows
you to model your cluster by modelling it after an existing cluster.
32. How do you fix the problem associated with VSAM out of space condition?
1. Define new VSAM dataset allocated with more space. 2. Use IDCAMS to REPRO the old VSAM file
to new VSAM dataset. 3. Use IDCAMS to ALTER / rename the old VSAM dataset or se IDCAMS to
DELETE the old VSAM dataset. 4. Use IDCAMS to ALTER / rename the new VSAM dataset to the name
of the original VSAM dataset.
33. What is the meaning of VSAM RETURN-CODE 28?
34. Correction to the previous question - Yor can have ALT INDEX only onKSDS and ESDS - not RRDS.
See the question for correction - you cannot have ALT INDEX for RRDS.
35. How amny Alternate Indexes you can have on a dataset? - Remember ALT INDEX is possibleonly
on KSDS and RRDS.
255 - but you must be a not to have so many ALT Indexes on a dataset!
36. Is it slower if you access a record through ALT INDEX as compared to Primary INDEX?
Yes. Why? Because the alternate key would first locate the primary key, which in turn locates the
actual record. Needs twice the number of I/Os.
RECOVERY (default) and SPEED are mutulally exclusive. Recovery preformats the control areas during
the initial dataset load, if the job fails, you can restart but you must have a recovery routine already
written to restart the job. SPEED does not preformat the CAs. It is recommended that you specify
SPEED to speed up your initial data load.
It defines the cross-region and cross-system sharing capabilities of the dataset. Syntax is SHR(CRvalue
CSvalue) value 1 means multiple read OR single write (read integrity) 2 means multiple read AND
single write (Write integrity) 3 means Multiple read AND multiple write 4 is same as 3, which
refreshes the buffer with every random access. default is SHR(1 3).
39. What does the KEYRANGES parmater in Define Cluster commend do?
It divides a large dataset into several volumes accoring to the Keyranges specified. e.g., KEYRANGES
((0000001 2999999) (3000000 5999999)). if the activity on the key ranges are evenly distributed,
cuncurrent access is possible, which is aperformance improvement.
IDCAMS is an access method services utility used for creating, deleting,altering VSAM files and
copying sequential file to a VSAM file, etc.
These two datesets are VSAM datasets. ESDS maintains control information.But LDS does not
maintains the control information.
An alternet index is an another way of accessing key sequenced data record stored in a base cluster
and path is the linkage which connect alternet index to its base cluster.
47. How many buffers are alloted to VSAM KSDS and ESDS?
Data buffers by default for ESDS.for KSDS it allots 2 data buffers and 1 index buffers. each buffer is
about 4k.
FREE SPACE(FPSC)
49. What's the device independent method to indicate where a Record is Stored?
What is VSAM?
Virtual Storage Access Method or VSAM, a file storage access method used in ZOS, MVS, and
OS/90 operating systems. IBM introduced VSAM in 1970. It’s a high-performance access
method that organizes data as files in mainframes.
The following table illustrates the key differences between VSAM and non-VSAM files:
They require software to create, edit, or remove VSAM Non-VSAM files can be created, edited, or delet
files. the ISPF capability.
This supports only the alternate index and the index. This supports no indexes.
Each file in VSAM includes two objects, each of which specifies its storage system.
Object FileBrowse: This object represents file browse actions. It entails using IDCAMS
or TSO prompts to carry out the Enable, ResetBr, ReadNext, and ReadPrv methods.
File object: It represents a single file. You can carry out operations like Read, Rewrite,
VSAM data sets to support different formats than non-VSAM data sets. The records in the VSAM
data sets are organized into groups called CIs (control intervals). Records of VSAM are stored
within the control interval, which is a limited storage space. A VSAM record’s length can be as
long as 1 cylinder. In VSAM, Records are organized according to the relative record number,
relative index key, or relative byte address.
Key-sequenced data set (KSDS) has records that are accessed by key-value pairs or
relative byte addresses, and the records are arranged by the key field. Records in the
Entry-sequenced data sets or ESDS, are only reachable via relative byte addresses and
include records either in the order of entry or in sequential order. Sequential data sets
are similar to ESDSs. Records in ESDS datasets may be either fixed or variable in length.
An unstructured data set with a Control Interval (CI) size greater than 4K makes up
The Relative Record Data Set or RRDS is a collection of records that may be accessed
using their relative record number. Records are kept in slots with a specified length in
RRDS databases.
VSAM Share Options controls users' access to VSAM datasets. Different users/jobs can be given
various levels of access to a single VSAM dataset by making use of these parameters.
The SHAREOPTS argument is written as SHAREOPTS in the DEFINE statement (a,b). Here, the
letters a and b stand for the cross-region share option, which describes how two or more users
or jobs on the same MVS system can share a file, and the cross-system share option, which
describes how users or jobs on separate MVS systems can share a file. This value is typically
SHAREOPTS (2 3).
Multiple users may handle the file concurrently if the cross-region value is 2, so long as only
one of them is an updater. The file can be processed by any number of jobs or users, as
indicated by the cross-system value of 3. (VSAM does not ensure integrity)
There is a chance that you will experience abends while working with VSAM databases. A VSAM
file's status can be determined by its VSAM file status code. Before VSAM files may be opened
for input or editing, they must first have at least one data record loaded into them.
Using the steps listed below, you can convert flat files into VSAM:
Step 1: Decide on your principal key first. You can also utilize the whole record as your
primary key.
Step 2: Sort the file using the primary key, or the full record, if none is supplied. Use a
Step 3: This step entails executing the JCL command IDCAMS - Define Cluster with the
Step 4: Lastly, use the IDCAMS REPRO command to load the flat file into VSAM.
Records are kept in sequential order, or in accordance with entry order, in both QSAM and
ESDS files. The below table highlights the major differences between them:
ALTINDEX cannot exist in QSAM files (Alternate Index). ALTINDEX can exist in ESDS files (Alternate Inde
It is feasible to create these files on tape. On tape, ESDS files cannot be produced.
The order in which records were added to the dataset is preserved in ESDS files. The records'
physical address, often known as RBA, is used to refer to them (Relative Byte Address).
If an ESDS dataset has 60 bytes per record, the first record's RBA would be 0, the second
record's RBA would be 60, the third record's RBA would be 120, and so on. RBA enables
addressed access or sequential access to records.
The information is kept in the order that it was entered. At the conclusion, new records are
added. The ESDS dataset does not allow for record deletion, although it does allow for
inactive record marking. Records in the ESDS dataset may have a variable or fixed length.
Integrated Data Cluster Access Method Services or IDCAMS, supports in manipulating VSAM
datasets. It can be used to create, remove, and alter VSAM datasets.
12. When is it preferable to use a VSAM file versus a standard Sequential file?
A VSAM file would be favored over a Sequential file in a number of circumstances. To name a
few:
In the Define cluster, "Freespace" is a crucial parameter. This option specifies the percentage
of freespace (available storage) that will be set aside for the data component's CI (control
intervals) and CA (control areas). 0% is the default setting.
Using IDCAMS commands, a variety of actions can be performed on VSAM datasets. Some of
the most helpful commands are listed below:
Generation(0) denotes the GDG generation that is currently in effect, Generation(-1) denotes
the GDG generation that came just before the current generation, and Generation(+1) denotes
the GDG generation that comes after the current generation.
The third generation of a GDG is the current generation, hence in JCL, we refer to it as
In JCL, generation(-1) refers to the generation (2nd generation) that came before the
Last but not least, JCL uses generation(-2) to refer to the generation (1st generation)
CI and CA occur when new data records are inserted. If there is not enough space to fit a
record in a CI than intended, the CI will split.
CA SPLIT: When an addition or update is not possible in the current CI, it refers to the
relocation or transfer of half of the records from one CA to another. Due to this, there
are now two CAs that are roughly halfway full as opposed to one full and one empty.
CI SPLIT: When an addition or update is not possible in the existing CI, it basically
refers to the movement/transfer of some records from the existing CI to a free CI within
18. How do you decide the optimal values for CI and free space?
The length of the record and the type of processing determines the Control Interval (CI) size.
Most of the time, CI is 4K. If the record length exceeds 1K, then choose CI sizes of 6K or 8K.
19. What does AMS perform in VSAM?
A service program known as an AMS (Access Method Service) can carry out a vast array of tasks
on VSAM/Non-VSAM datasets and catalogs. IDCAMS, a potent utility program included with
AMS, may be accessed via a common JCL and performs a wide range of AMS operations using
its instructions. AMS uses two different types of commands:
Functional commands, such as DEFINE CLUSTER, REPRO, VERIFY, DELETE, BLDINDEX, and
LISTCAT, demand actual action.
Modal instructions: These are commands that outline the prerequisites for carrying out
functional ones like "IF-THEN-ELSE." Users using the Time Sharing Option (TSO) can only
issue functional commands; modal commands are not allowed.
20. What do the terms Control Area (CA) and Control Interval (CI) mean?
Each data record is kept as a part of a unit called the Control Interval (CI) in the VSAM cluster's
data component, and each Control Interval is stored in a unit called the Control Area (CA).
Control area (CA): A control area (CA) is made up of numerous CI (Control intervals). A
VSAM dataset may contain one or more CAs, depending on the quantity of records.
Control intervals are divided into CAs, and data recordings are organized into CIs.
Cylinders or disc tracks are used to measure the size of Control Areas.
Control Interval (CI): Data records and other control information are kept in VSAM's
approaches, a block stands in for a unit of data being transferred between memory and
storage devices. In VSAM, CI represents a unit of data exchanged between the memory
(buffer) and storage device (DASD). When the cluster is defined, a control interval size is
The VSAM is made up of clusters, which are collections of datasets used to store data. A
dataset's index, sequence set, and data sections are all categorized into clusters. Each VSAM
cluster is located within an area that is separated into CIs, or contiguous regions (Control
Intervals). There are two primary parts of a VSAM cluster:
Index Component: The index part makes up this component. Using the index
component, VSAM fetches records from the data component.
Data Component: The data are located in this component. It includes the real
recordings of data.
22. How can you resolve the issue when VSAM runs out of space?
In addition to the primary index, further indexes are made for the ESDS/KSDS datasets.
Multiple keys can access records thanks to alternate indexes. The alternate index's key may
include duplicates; it need not be unique.
24. What kinds of access options are available for the VSAM files?
For VSAM files, the following three access methods are available:
Dynamic Access: To enable dynamic access, use the code ACCESS IS DYNAMIC in the
FILE-CONTROL entry. Dynamic access combines sequential and random access inside
the same application. One program can be created to carry out both sequential and
Random Access: To enable random access, enter the code ACCESS IS RANDOM in the
FILE-CONTROL entry. The value entered in a key field allows access to records inside
indexed files, while the value entered in the relative key allows access to records within
relative files.
Sequential Access: To enable sequential access, use the code ACCESS IS SEQUENTIAL
in the FILE-CONTROL entry. Records within relative files can be retrieved using their
relative record numbers, and records within indexed files can be accessed using the
In general, using large CI and buffer space VSAM parameters may aid in enhancing the
application's performance. Sequential access is the most effective compared to dynamic and
random accesses.
The file status 23 means the ‘file not found’. The record you try to access using a key is not
found.
RDF is also known as Record Definition Fields. They describe record lengths and indicate how
many adjacent records have a similar length. They are 3 bytes long.
The VERIFY command makes sure that the catalog accurately reflects the end of the VSAM
data set when a VSAM data set is incorrectly closed as a result of an error. Owing to the
inaccuracy, the catalog might have been incorrect. Additionally, the VSAM processing that was
put on hold when the RECOVER option was inserted is finished by the VERIFY command.
Index Component contains the indexes and helps in retrieving the records from the data
component. Data Component contains the data records.
Building a resume: Start by carefully building your resume. Everything you include in
your resume should be expressed with confidence and clarity. Additionally, please
might ask you some behavioral questions. Therefore, be sure to prepare for that as
well.
Research the company: This is a key tip that the majority of people miss. Start reading
Demonstrate your skills: Even if you are a technical guru, being unable to
ability.
examples. This demonstrates to the interviewer that the candidate is aware of how to