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

VSAM Questions and Answers

This document contains questions and answers about VSAM. It discusses topics like fixing VSAM out of space conditions, alternate indexes, control intervals, control areas, and using IDCAMS utilities to manage VSAM datasets.

Uploaded by

Nitin Garg
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

VSAM Questions and Answers

This document contains questions and answers about VSAM. It discusses topics like fixing VSAM out of space conditions, alternate indexes, control intervals, control areas, and using IDCAMS utilities to manage VSAM datasets.

Uploaded by

Nitin Garg
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

VSAM Questions and Answers

Question: How do you fix the problem associated with VSAM out of space
condition?
Answer: 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.

Question: What is the meaning of VSAM RETURN-CODE 28?


Answer: Out of space condition is raised.

Question: How many Alternate Indexes you can have on a dataset? -


Remember ALT INDEX is possible only on KSDS and RRDS.
Answer: 255 - but you must be a nut to have so many ALT Indexes on a
dataset!

Question: Is it slower if you access a record through ALT INDEX as compared


to Primary INDEX?
Answer: 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.

Question: What are RECOVERY and SPEED parameters in DEFINE CLUSTER


command?
Answer: RECOVERY (default) and SPEED are mutually exclusive. Recovery
performs 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 perform the CAs. It is recommended that you
specify SPEED to speed up your initial data load.

Question: describe SHAREOPTIONS parameter (SHR) in Define Cluster


command.
Answer: It defines the cross-region and cross-system sharing capabilities of
the dataset. Syntax is SHR (CR value CS value) 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).

Question: What does the KEYRANGES parameter in Define Cluster commend


do?
Answer: It divides a large dataset into several volumes according to the Key
ranges specified. e.g., KEYRANGES ((0000001 2999999) (3000000
5999999)). if the activity on the key ranges are evenly distributed,
cuncurrent access is possible, which is a performance improvement.

VSAM Questions and Answers 1


Question: What are the optional parameters to the input dataset While
loading the empty cluster with the data records?
Answer:
1) FROMADDRESS(address)
2) TOADDRESS(address) where 'address' specifies the RBA value of the key
of the input record.
3)FROMNUMBER(rrn)
4)TONUMBER(rrn) where 'rrn' specifies the relative record number of the
RRDS record
5)FROMKEY(key)
6)TOKEY(key) where 'key' specifies the key of the input record
7)SKIP(number)
8)COUNT(number) where 'number' specifies the number of records to skip or
copy Ex: REPRO INFILE(DD1) OUTFILE(DD2) SKIP(9000) COUNT(700) -
Skips the first 9000 records and begins copying at 9001 and copies 700
records from DD1 to DD2.

Question: What is GDG means in VSAM???


Answer: Generation Data Group

Question: What is IDCAMS and what is the purpose of it?.


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

Question: How to delete a member using JCL.


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

Question: What is the Difference between LDS & ESDS ?


Answer: These two datasets are VSAM datasets. ESDS maintains control
information. But LDS does not maintain the control information.

Question: A. Is a delete operation possible in an ESDS? B. Is rewrite


operation possible in ESDS?
Answer: No delete operation is not possible in VSAM ESDS. B. Yes rewrite
operation is possible in an ESDS but record for the same length.

Question: What is an alternate index and path ?


Answer: An alternate index is another way of accessing key sequenced data
record stored in a base cluster and path is the linkage which connect
alternate index to its base cluster.

Question: How many buffers are allotted to VSAM KSDS and ESDS?
Answer: 2 data buffers by default for ESDS. For KSDS it allots 2 data buffers
and 1 index buffers. Each buffer is about 4k.

Question: what's the biggest disadvantage of using a VSAM dataset?

VSAM Questions and Answers 2


Answer: FREE SPACE (FPSC)

Question: what's the device independent method to indicate where a Record


is Stored?
Answer: By USING RBA (Relative Byte Address).

Question: Q: HOW MANY TIMES SECONDARY SPACE ALLOCATED?


Answer: A: 122 TIMES

Question: what is the RRN for the first record in RRDS?


Answer: 1

Question: what is a Base Cluster?


Answer: The Index and data components of a KSDS

Question: If fspc(100 100) is specified does it mean that both the control
interval and control area will be left empty because 100 % of both ci and ca
are specified to be empty?
Answer: no, they would not be left empty. One record will be written in each
CI and 1 CI will be written for each CA.

What types of VSAM data sets do you know?

- Entry Sequenced Data Set is like a standard sequential data set.


Its records are processed one at a time in the order in which they were
loaded.
- A Key Sequenced Data Set is like an ISAM file, its records may be
processed sequentially or randomly based on a key value. A KSDS is often
called an indexed file.
- A Relative Record Data Set is like a non VSAM relative file. Its records
can be accessed based on their relative positions in the file.

2. What is a CONTROL INTERVAL?


- A unit of data that is transferred between auxiliary storage and virtual
storage when an I/O request is made. It contains records, free space and
control information.

- Control information consists of RDF (Record Descriptor Field) and CIDF


(Control Interval Descriptor Field). Every CI contains one CIDF which is a
field consisting of the last 4 bytes of a CI. It contains information about the
offset and the length of free space in the CI. In case of fixed size records
each CI contains two RDF's and each RDF is 3 bytes in length. In case of the
variable size records, there is a separate RDF for each record in the CI. The
size of the Data portion of the CI should be multiple of 512 bytes or 2,048
bytes. Max size of the CI is 32K. The size of the index portion of CI could be
one of the following: 512, 1024, 2048, 4096.

VSAM Questions and Answers 3


3. What is CONTROL AREA?
- A group of contiguous CI's forms a CA within a data space. The max size of
the CA is equal to one cylinder.

4. What is a CONTROL INTERVAL SPLIT?


- The movement of some records from an existing CI to another free CI in
the same CA because a record add or update cannot be accommodated in
the existing one. This result in two half-empty CI's instead of one full and
one empty CI. CI split require a number of I/O operations and this degrades
the performance of the VSAM file. A right amount of the space should be
allocated for the CI (internal percentage of free space allocation).

6. How can you prevent CI and CA splits?


- Right amount of internal and external percentage of freespace allocation
should be specified
- VSAM file reorganization should be provided on a constant basis depending
on the activity against that file.

7. What is VSAM file reorganization?


Answer: The purpose of the VSAM file reorganization is to restore internal
and external percentage of free space allocations. It should be done in the
following steps:

- Unloading of the VSAM file on the tape or any sequential file;


- Reloading (restoring) of the VSAM file back from the sequential file.

9. What is the structure of KSDS?


- KSDS consists of index component and data component. Data component
contains data record CI's. Index component consists of index record control
intervals.
- Index Record CI's: Each index record consist of the highest key of the CI
it points to and the direct address of that CI on the disk. Index component
has a hierarchical structure. The lowest level of that structure is called
a sequence set.

10. What is a SEQUENCE SET?


Answer: Sequence Set is the lowest level of the Index Component. Each CI in
the sequence set is responsible for a specific CA in the data component. Each
CI within the sequence set contains pointers to the CI's within the data
component. In addition to that, CIs of the sequence set also contain
horizontal pointers between themselves which are used for the sequential
processing of the VSAM files.

11. Can you describe how VSAM locates a record randomly?


- VSAM starts from the highest level of the index component. It will use the
vertical pointers to locate a CI in the data component which may contain the

VSAM Questions and Answers 4


desired record. VSAM will process the records of the CI sequentially to
determine whether that CI contains the desired record. VSAM will indicate
this to the pgm thru the file status field.

12. What should be taken into consideration to calculate CI size?


- CI size should be multiple of 512 or 2048 bytes;
- Insertion activity against VSAM file. Depending on the insertion activity
of a file free space to insert 1, 2 or more records should be allocated;
- Record length;
- For fixed length VSAM file records, there will be 2 RDF's and 1 CIDF per CI
occupying 10 bytes. For variable length records there will be one CIDF per
CI and RDF for every record in the CI.

13. How can you create a VSAM cluster?

- VSAM data space has to exist on the desired volume, if not, IDCAMS
DEFINE SPACE function should be executed for that volume, and then next
functions:
- DEFINE CLUSTER;
- REPRO - will load VSAM Cluster from another VSAM file or sequential file.

14. What can you delete thru the usage of IDCAMS DELETE function?
- It is used to delete VSAM and non VSAM objects such as clusters, alternate
indexes, and paths. VSAM data space can also be deleted.

15. What is the purpose of ALTER function?

- To be able to change the catalog information about VSAM files deleting or


reallocating it.

16. What is a RECORD KEY?

- Record Key indicates to the system where in the record of the VSAM file the
key is located. Record key should be described in the File Section.

17. What is a FILE STATUS?


- File status is a field described in the W-S Section (PIC X(2)) and which
is used by VSAM to indicate to the pgm how successfully the execution of the
latest request against VSAM file was. File Status should be checked by the
pgm after execution of any I/O operation against VSAM file.

18. What is the purpose of the START command?


- To position a current record pointer on a desired record. This command
should be followed by Read statements which bring that record into the pgm.

19. How can you change a record from the VSAM file?
- Move Tr-Key to Record-Key field;

VSAM Questions and Answers 5


- Read a record from VSAM file;
- Change desired field;
- Rewrite the record;
- Check for the file status (acceptable value is: 00).

21. What should be done in a pgm to delete a record from the VSAM file?
- Move Tr-Key to Record-Key field;
- Delete a record;
- Check for file status (acceptable values of the status are:
00 - successful and
23 - record not found.
In any other case pgm should be terminated).

22. What is the layout of the Alternative Index record?


- First field in the Alternate Index Record is an Alternate Index itself.
That field will be followed by as many pointers to the base cluster as there
are duplicates.

23. Describe the sequence of steps when base cluster is being accessed
through the alternate Index?

- VSAM starts from the upper level of Alternate Index Component;


- VSAM will use direct vertical pointers to locate a record in the data
component containing that alternate index value;
- VSAM will use the accessed value of the prime key and will locate that
record in the base cluster. If record is located in the base cluster the
value of the file status is 00, if record is not found the value of the
file status is 23. In case of duplicates VSAM will use the first pointer to
the base cluster and locate appropriate record in it. File status in this
case will be 02. This file status will indicate that there are more
duplicates to process. Then VSAM will use the second pointer in the
alternate index record and the second duplicate will be accessed from the
base cluster. The following processing will be continued by the pgm until
all duplicates are processed and file status in that case will be 00.

24. How can you process AIX in the COBOL pgm?


- SELECT statement for the VSAM file should specify ALTERNATE KEY IS and
name the alternate index;
- Alternate Index should be specified in the File Section Description of the
VSAM file.
- Random Read statement should have the following clause:
KEY IS and the name of the alternate index.

25. How can you process VSAM file sequentially trough the Alternate Index?
- The pgm has to use a START command which names the Alternate Index;
- The pgm has to use a Read New Record command with at end option:
(Read VSAM-Master Next Record at end Perform At-End-Processing).

VSAM Questions and Answers 6


26. How can you find out information about VSAM Clusters in a Catalog?
- This information is listed in the report produced by Listcat Entries
function of the IDCAMS pgm.

27. How can you find out what is the amount of unused space for a specific
VSAM cluster?
-Compare higher allocated RBA with Higher used RBA Listcat function listing.

28. How can you find out the number of CI and CA splits for specific VSAM
cluster?
- This information is listed in the report produced by Listcat Entries
function of the IDCAMS pgm.

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


- To verify whether VSAM file was properly closed.

30. How can you allocate AIX?


The base cluster should exist and be loaded with at least one record;
DEFINE AIX;
DEFINE PATH;
BLDINDEX;
The purpose of the Define AIX function is to create an entry for the
Alternate Index in the catalog and to preserve space for that alternate
index on the volume;
The purpose of the DEFINE PATH function is to create a path between
alternate index and base cluster;
The purpose of the BLDINDEX function is to build alternate index file.
During the execution of this function base cluster file will be opened as
input and alternate index will be opened as output. Records of the AIX file
will be built and stored in the ascending sequence based on the alternate
index key value.

Can AMS commands be run from the TSO prompt ?


Yes

What is Control Interval, Control Area


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

What is FREESPACE ?

VSAM Questions and Answers 7


Coded in the DEFINE as FREESPACE(ci ca) where ci is the percentage of
each control interval to be left free for insertions, ca is the
percentage of control intervals in each control area to be left empty.

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


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 is envisaged.
Usual values are (20 20) when heavy updates are expected. CI size can be
calculated.

Would you specify FREESPACE for an ESDS?


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.

What is SHAREOPTS ?
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).

What is the meaning of each of the values in SHAREOPTS(2 3)?


Value of 2 for cross region means that the file can be processed
simultaneously by multiple users provided only one of them is an
updater. Value of 3 for cross system means that any number of jobs can
process the file for input or output (VSAM does nothing to ensure
integrity).

How do you define a KSDS ?


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, SHAREOPTIONS.

How do you define an ALTINDX ? How do you use ALTINDXs in batch, CICS
pgms ?
DEFINE ALTERNATEINDEX. Important paramters are RELATE where you specify
the base cluster name, KEYS, RECORDSIZE,SHAREOPTIONS,UNIQUEKEY(or
NONUNIQUEKEY), DATA(ds name for the data component), INDEX(ds name for
the index component).
Then DEFINE PATH. Important paramters are NAME (ds name for the path),
PATHENTRY (ds name of the alternate index name), UPDATE(or NOUPDATE)
which specifies whether an alt index is updated when a update to the
base cluster takes place.
Then BLDINDEX. Parameters are INDATASET(ds name of base cluster),
OUTDATASET(ds name of AIX).

Using alternate indexes in batch pgms:


In the JCL, you must have DD stmts for the cluster and for the path(s).
In the cobol pgm, SELECT .. ASSIGN TO ddname for base cluster RECORD KEY
IS... ALTERNATE RECORD KEY IS..

VSAM Questions and Answers 8


Using alternate indexes in CICS pgms:
FCT entries must be created for both base cluster & the path. To read
using the alternate index, use the dd name of the path in CICS file
control commands.

What happens when you open an empty VSAM file in a COBOL program for
input?
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.

How do you initialize a VSAM file before any operation? A VSAM with
alternate index?
Can write a dummy program that just opens the file for output & then
closes it.

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


Duplicate alternate key. Happens on both input and output operation

How do you calculate record size of an alternate cluster? Give your


values for both unique and non-unique.
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

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.

How do you load a VSAM data set with records ?


Using the REPRO command.

How do you define a GDG ?


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)

Do all versions of the GDG have to be of the same record length ?


No, the DCB of the model dataset can be overridden when you allocate new
versions.

How are different versions of GDG named ?


base-file-name.GnnnnnV00 where nnnn= generation number (upto 255).
nnnn will be 0000 for the 1st generation.

Suppose a generation of GDG gets created in a particular step of a


proc. How would you refer the current generation in a subsequent step?
What would be the disposition of this generation now?

VSAM Questions and Answers 9


Relative generation numbers are updated only at the end of the job, not
at the end of a step. To allocate a new generation, we would be using
(+1) with a DISP of (NEW,CATLG,DELETE). To refer to this in a subsequent
step in the same job, we would again use (+1) but with a DISP of SHR or
OLD.

What more info you should give in the DD statement while defining the
next generation of a GDG?
Give (+1) as the generation number, give (new,catlg) for disp, give
space parameter, can give the dcb parameter if you want to override the
dcb of the model dataset.

Assuming that the DEFINE jcl is not available, how do you get info about
a VSAM file's organisation ?
Use the LISTCAT command.

During processing of a VSAM file, some system error occurs and it is


subsequently unusable. What do you do?
Run VERIFY.

VSAM Questions and Answers 10

You might also like