0% found this document useful (0 votes)
2 views

VSAM Interview Questions

The document provides a comprehensive overview of VSAM (Virtual Storage Access Method), detailing various types of VSAM datasets, their structures, and key features. It includes interview questions and answers covering topics such as dataset types, control intervals, alternate indexes, and file operations. Additionally, it highlights the differences between VSAM and non-VSAM files, as well as the utility program IDCAMS used for managing VSAM datasets.

Uploaded by

Brindha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

VSAM Interview Questions

The document provides a comprehensive overview of VSAM (Virtual Storage Access Method), detailing various types of VSAM datasets, their structures, and key features. It includes interview questions and answers covering topics such as dataset types, control intervals, alternate indexes, and file operations. Additionally, it highlights the differences between VSAM and non-VSAM files, as well as the utility program IDCAMS used for managing VSAM datasets.

Uploaded by

Brindha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

VSAM Interview Questions

1. What are the types of VSAM datasets?


Entry sequenced datasets (ESDS), key sequenced datasets (KSDS) and relative record
dataset (RRDS)

2. How are records stored in an ESDS, entry sequenced dataset?


They are stored without respect to the contents of the records and in the order in which
they are included in the file.

3. What is a CI, control interval?


A control interval is the unit of information that VSAM transfers between virtual and
auxiliary storage.

4. What are the distinctive features of a ksds, key sequenced dataset?


The index and the distributed free space.

5. What is a CA, control area?


A group of control intervals makes up a control area.

6. What is a sequence set?


This is the part of the index that points to the CA and CI of the record being accessed.
7. What is the index set?
This is the other part of the index. It has multiple levels with pointers that ultimately reach
to the sequence set.

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.

9. What is the catalog?


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

10. What is an alternate index?


An AIX is a file that allows access to a VSAM dataset by a key other than the primary one.

11. What is a path?

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.

12. What is the upgrade set?

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.

13. What is free space?

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

14. What is a VSAM split?

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 is the base cluster?

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?

The ORGANIZATION is INDEXED.

18. In the COBOL SELECT statement for a KSDS what are the three possibilities for ACCESS?

ACCESS can be SEQUENTIAL, RANDOM or DYNAMIC.

19. What is the COBOL RECORD KEY clause?

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?

It must be opened as I/O.

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.

23. What is the meaning of dynamic processing?

It's rarely used. It means one program uses both sequential and random processing for a VSAM KSDS
file.

24. Name some common VSAM error conditions and codes.

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.

26. What is a VSAM slot?

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.

27. What is the utility program closely associated with VSAM?

IDCAMS, the access method services utility.

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?

They are DEFINE CLUSTER, DATA and INDEX.

30. What is the significance of the SHAREOPTIONS parameter?

It specifies how the file may be shared between jobs and between batch and CICS environments.

31. What is the meaning of the DEFINE MODEL parameter?

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?

Out of space condition is raised.

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.

37. What is RECOVERY and SPEED parameters in DEFINE CLUSTER command?

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.

38. Describe SHAREOPTIONS parameter (SHR) in Define Cluster command.

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.

40. What is GDG means in VSAM?

Generation Data Group


41. What is IDCAMS? and what is the purpose of it?

IDCAMS is an access method services utility used for creating, deleting,altering VSAM files and
copying sequential file to a VSAM file, etc.

42. How to delete a member using JCL.

Using IDCAMS a member can be deleted. DELETE 'XXX.YYY(member)

43. What is the Difference between LDS & ESDS ?

These two datesets are VSAM datasets. ESDS maintains control information.But LDS does not
maintains the control information.

44. Is a delete operation possible in an ESDS?

No delete operation is not possible in VSAM ESDS.

45. Is rewrite operation possible in ESDS?

Yes rewrite operation is possible in an ESDS.

46. What is an alternet index and path?

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.

48. What's the biggest disadvantage of using a VSAM dataset?

FREE SPACE(FPSC)

49. What's the device independent method to indicate where a Record is Stored?

By USING RBA(Relative Byte Address).

50. How many times secondary space allocated?


122 TIMES

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.

State variations between VSAM and Non-VSAM Files.

The following table illustrates the key differences between VSAM and non-VSAM files:

VSAM File 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.

Supports data on a disc but is unable to handle data on


File storage is possible on discs and tapes.
other media, such as tapes.

BSAM files, flat files, QSAM files, sequential files


An ESDS, LDS, KSDS, or RRD files examples of a VSAM file.
examples of non-VSAM files.

The disorganized index makes data retrieval tim


Data retrieval is facilitated with a well-organized index.
consuming.

Data retrieval may be linear, dynamic, random, or


This support only sequential data retrieval.
sequential.

This supports only the alternate index and the index. This supports no indexes.

Datasets can be shared between different systems and


Datasets are kept locally.
geographical areas.

3. What types of objects are available in VSAM files?

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,

Delete, UnlockWrite, and StartBr.


4. Describe the VSAM data set.

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.

Related Article: IBM DB2 Interview Questions

5. What are the different VSAM file types?

VSAM supports the following file types:

 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

KSDS dataset might have variable or fixed lengths.

 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

an LDS (Linear Data Set).

 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.

6. What do you mean by the share option in VSAM?

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)

7. Explain file status in VSAM.

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.

8. How to convert a flat file into a VSAM file?

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

SORT statement to eliminate duplicates.

 Step 3: This step entails executing the JCL command IDCAMS - Define Cluster with the

output from step 2 (the sorting methods) as input.

 Step 4: Lastly, use the IDCAMS REPRO command to load the flat file into VSAM.

9. State differences between ESDS and QSAM files.

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:

QSAM Files ESDS Files

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.

10. How do ESDS files store records?

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.

11. Describe IDCAMS.

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:

 When a file is subjected to several actions based on a certain key value.


 When carrying out numerous operations on a file, like changing a particular record or
deleting files.
 Whenever you require a file whose contents will frequently need to be changed
(update, remove, or insert records).
 When several operations are necessary, such as when a record must be accessed in a
number of ways, such as sequentially, with a key, or dynamically.
13. Is it possible to input an empty VSAM file into a Cobol program?
It is not possible to open a VSAM file that is empty or devoid of any records in order to utilize it
as an input for a COBOL program. Users won't be able to access them anymore. Instead, a
blank file might be opened for output. When the user opens the file, COBOL writes a fake
record into it and removes it.
Releted Article: COBOL Interview Questions

14. Describe Freespace.

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.

VSAM Interview Questions For Experienced


15. Which IDCAMS commands can be used with VSAM?

Using IDCAMS commands, a variety of actions can be performed on VSAM datasets. Some of
the most helpful commands are listed below:

 Repro: Data is loaded into the VSAM dataset.


 Delete: Remove the catalogs, the VSAM, and non-VSAM datasets.
 Alter: Changes the VSAM file attributes ( path, cluster, catalog, etc.)
 Listcat: Gets information about the VSAM dataset catalog.
 Print: Prints the contents of a VSAM dataset.
 Repro: Data is loaded into the VSAM dataset.
16. How would you refer to the first generation in the JCL if a GDG has three generations?

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

generation(0) when there are three generations of a GDG.

 In JCL, generation(-1) refers to the generation (2nd generation) that came before the

current generation (3rd generation).

 Last but not least, JCL uses generation(-2) to refer to the generation (1st generation)

shortly before the 2nd generation.

Releted Article: JCL Interview Questions

17. Tell us about CI Split and CA Split.

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

the same CA.

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

Control Interval (CI), a contiguous storage space. In non-VSAM data management

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

supplied. Control Intervals have a bytes-based size. for illustration, 2 kilobytes.

21. What does "Cluster in VSAM" mean?

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?

If VSAM is out of space, you can solve the issue as follows:

 Make a new VSAM dataset with more space set aside.


 Using the IDCAMS REPRO command, transfer the old VSAM file into the new VSAM
dataset.
 Using IDCAMS, modify, rename, or remove an old VSAM dataset.
 With IDCAMS, the name of the new VSAM dataset can be changed to match the name of
the original VSAM dataset.
23. What is VSAM Alternate Index?

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 actions thanks to dynamic access, enabling some data to be accessed in

sequential order and others dependent on their keys.

 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

key field chosen (either the primary key or an alternate key).

25. What is GDG in VSAM?


A GDG (Generation Data Group) is often made up of a number of linked non-VSAM data sets
that are organized chronologically. Each dataset connected to the GDG base is referred to as a
GDG version. These datasets are organized according to a common name known as the GDG
base. There can be 255 generations in a GDG base. For processing data sets created on a
regular basis, such as monthly, weekly, daily, and hourly, they are very efficient tools. The
dataset is created in new generations with each processing cycle. There are a variety of uses
for GDG, including, Statistics, Invoicing, Reporting, Audit Trails, Back-Up, etc.
VSAM FAQs
1. Which VSAM type is the fastest?

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.

2. What is status 23 in VSAM?

The file status 23 means the ‘file not found’. The record you try to access using a key is not
found.

3. What is RDF in VSAM?

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.

4. What is the use of the verify command in VSAM?

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.

5. What are the two major parts of VSAM?


The index component and data component are the two major parts of the VSAM cluster.

Index Component contains the indexes and helps in retrieving the records from the data
component. Data Component contains the data records.

Tips to prepare for a VSAM Interview


Some of the preparation tips for VSAM interviews are as follows:

 Building a resume: Start by carefully building your resume. Everything you include in

your resume should be expressed with confidence and clarity. Additionally, please

make sure that your resume includes some VSAM-based Projects.


 Be well-prepared: In addition to VSAM-related technical questions, the interviewer

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

up on the company before heading to an interview.

 Demonstrate your skills: Even if you are a technical guru, being unable to

communicate effectively will become a huge disadvantage. Communication is a key

ability.

 Give some real-world examples: In your responses, mention some real-world

examples. This demonstrates to the interviewer that the candidate is aware of how to

put theoretical concepts into practice.

You might also like