VSAM Technical FAQs



VSAM FAQs

Table of Contents

VSAM DataSet Organization 1

Access Method Services (AMS) 105

Common VSAM Error Codes 148

VSAM DataSet Organization 3

1. What is VSAM? 3

2. What are the different types of VSAM datasets? 3

3. What is an ESDS? 3

4. What is a KSDS? 3

5. What is a RRDS? 3

6. What is a LDS? 3

7. What type of file is preferred for sequential processing ? Why? 3

8. When we would prefer KSDS over RRDS? 3

9. Is it possible to catalog a VSAM dataset in a CVOL (Control Volume)? 4

10. How do you define a KSDS ? 4

11. What is the relation between the Master Catalog, User Catalog, and Data Sets which could be catalogued in the User Catalog? 4

12. What is a CONTROL INTERVAL (CI)? 4

13. What is a CONTROL AREA(CA)? 4

14. Explain the information contained in the Control Interval? 4

15. Explain the information contained in Control Field? 4

16. What is a CI SPLIT? 4

17. How do you know if a file has CI split or not and how many splits? 5

18. Is it good to have a CI split? 5

19. How do you rectify CI splits? How do you get rid of CI splits? 5

20. What is a CA SPLIT? 5

21. What is a cluster? 5

22. What is the catalog? 5

23. What is Free space? 5

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

25. Would you specify FREESPACE for an ESDS? 5

26. When we give the parameters for Free space like 100, 100 does it mean that will it completely be empty 6

27. What is a Spanned Records? 6

28. What is a Base Cluster? 6

29. What is an Alternate index? 6

30. Whether an Alternate Index can be defined for Entry Sequential Dataset? 6

31. Whether an Alternate index can be defined for RRDS? 6

32. What are the three steps in creating the AIX? 6

33. How do you define an ALTINDX ? 6

34. What is a Path? 7

35. How do you use ALTINDXs in batch, CICS programs ? 7

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

37. What is Upgrade and Update? When will you specify them? 7

38. What is an index set? 7

39. What is a sequence set? 7

40. What is a RECORD KEY? 8

41. How many Alternate Indexes you can have on a dataset? - Remember ALT INDEX is possible only on KSDS and RRDS. 8

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

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

44. What is a Base Cluser? 8

45. Describe SHAREOPTIONS parameter (SHR) in Define Cluster command. 8

46. What does the KEYRANGES parameter in Define Cluster command do? 8

47. What are the optional parameters to the input dataset While loading the empty cluster with the data records? 8

48. How many buffers are allocated to VSAM KSDS and ESDS? 9

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

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

51. How many times Secondary Space Allocated? 9

52. What is the VSAM-code field? 9

53. What is a VSAM slot? 9

54. What is File Status in VSAM? 9

Access Method Services (AMS) 10

55. What is AMS? 10

56. What is IDCAMS ? 10

57. What are the IDCAMS commands that can be used for VSAM and explain each of them. 10

58. What is the syntax of AMS Modal Commands? 10

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

60. How can you find out information about VSAM Clusters in a Catalog? 11

61. If you wish to use the REWRITE command how should the VSAM file be opened? 11

62. What is the purpose of the VERIFY function of IDCAMS? 11

63. What is the meaning of the DEFINE MODEL parameter? 11

64. How can you find out what is the amount of unused space for a specific VSAM cluster? 11

65. What is the significance of the SHAREOPTIONS parameter? 11

66. What is SHAREOPTS ? 11

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

68. How do you initialise a VSAM file before any operation? a VSAM with alternate index? 12

69. What is the difference between sequential files and ESDS files? 12

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

71. A VSAM file has the keys AA, BB, CC, DD, EE, FF, GG, HH, II … ZZ. You have used START BROWSE command to point to the record with key=GG. After three READNEXT commands and one READPREV command, which record will be read? 12

72. What do you mean by reusable files in VSAM? 12

73. When a reusable file is opened in VSAM what will happen? 12

74. How do you change a key on a VSAM file? 12

75. Can you create a Linear VSAM dataset and use it in the Program? Is there any purpose of doing it? 12

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

77. What is the purpose of the START command? 13

78. While executing a READ statement in VSAM file what happens and how much data is accessed at that time? 13

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

80. In the COBOL SELECT statement what is the ORGANIZATION for a KSDS? 13

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

82. Assuming that the DEFINE JCL is not available, how do you get info about a VSAM file's organization ? 13

83. During processing of a VSAM file, some system error occurs and it's subsequently unusable. What do you do? 13

84. How do you fix the problem associated with VSAM out of space condition? 13

85. What is the purpose of the FILE STATUS clause in the SELECT statement? 14

Common VSAM Error Codes 15

86. Name some common VSAM error conditions and codes. 15

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

VSAM DataSet Organization

1. What is VSAM?

VSAM Stands for Virtual Storage Access Method. It is a High Performance Access Method.

2. What are the different types of VSAM datasets?

Entry sequenced datasets (ESDS)

Key sequenced datasets (KSDS)

Relative record dataset (RRDS)

Linear datasets (LDS).

3. What is an ESDS?

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.

4. What is a KSDS?

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.

The distinctive features of a KSDS are the index and the distributed free space.

5. What is a RRDS?

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.

6. What is a LDS?

LDS have the data in the form of long stream of bytes, i.e., A VSAM data set that contains data but no control information. A linear data set can be accessed as a byte-addressable string in virtual storage.

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.

7. What type of file is preferred for sequential processing ? Why?

ESDS files are used for sequential processing.

You can access data faster using ESDS files for sequential processing.

8. When we would prefer KSDS over RRDS?

KSDS is mainly preferred for record access with keys.

9. Is it possible to catalog a VSAM dataset in a CVOL (Control Volume)?

No.

VSAM datasets can be catalogued either in MASTER catalog or USER catalog.

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

11. What is the relation between the Master Catalog, User Catalog, and Data Sets which could be catalogued in the User Catalog?

Master Catalog should contain pointers to the User Catalogs. All data sets catalogued in the user catalog should have a higher level qualifier equal to the name of the user catalog.

12. What is a CONTROL INTERVAL (CI)?

A unit of data that is transferred between auxiliary storage and virtual storage when an I/O requests is made. I.e., the records are read or written.

13. What is a CONTROL AREA(CA)?

A group of control intervals makes up a control area.

14. Explain the information contained in the Control Interval?

Logical Records Area (LRA) that contains the records,

Control Interval Free Space (FSPC) the free space reserved during the creation of VSAM datasets,

Unused Space (US) and

Control Fields (CF).

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, and 4096.

15. Explain the information contained in Control Field?

Control Field 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 one 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.

16. What is a CI 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 results in two half-empty CI's instead of one full and one empty CI. CI split requires 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).

17. How do you know if a file has CI split or not and how many splits?

Using IDCAMS and LISTCAT

18. Is it good to have a CI split?

No, Application program’s performance will be reduced

19. How do you rectify CI splits? How do you get rid of CI splits?

Using REORG.

By giving appropriate FREESPACE while creating the datasets.

20. What is a CA SPLIT?

The movement of the half of the records in an existing CA to a new CA because a record add or update cannot be accommodated in the existing CA. This results in two approximately half-full CA's instead of one full and one empty CA. This is very insufficient because it involves a lot of I/O operations.

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

22. What is the catalog?

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

23. What is Free space?

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

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

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

26. When we give the parameters for Free space like 100, 100 does it mean that will it completely be empty

No, One record will be left for each control interval

27. What is a Spanned Records?

Spanned records are the records that are longer than a control interval. VSAM stores as much of the record as will fit in one control interval and spills over the remainder of the record into the next control interval.

28. What is a Base Cluster?

The data component and the index component for KSDS are stored as two separate entities. These entities are called as base cluster. The base cluster consists of the data component and the index component for the primary index of a KSDS.

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

30. Whether an Alternate Index can be defined for Entry Sequential Dataset?

YES.

Note: In Batch Programs we can access through AIX.

CICS online programs can access the data using AIX.

31. Whether an Alternate index can be defined for RRDS?

No.

32. What are the three steps in creating the AIX?

Define the AIX

Specify the AIX PATH

Build Index

33. How do you define an ALTINDX ?

DEFINE ALTERNATEINDEX. Important parameters 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 parameters 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). If you use INFILE or OUTFILE specify the dd-name after declaring it in JCL.

34. What is a Path?

A path is the connection between the alternate index and the records in the base cluster. In specifying the path, records can be retrieving based on the primary key or on some alternate key.

35. How do you use ALTINDXs in batch, CICS programs ?

In Batch Programs:

In the JCL, you must have DD statements for the cluster and for the path(s). In the Cobol program, SELECT .. ASSIGN TO dd-name for base cluster RECORD KEY IS... ALTERNATE RECORD KEY IS..

In CICS programs:

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.

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

37. What is Upgrade and Update? When will you specify them?

UPDATE will be specified while defining the PATH.

UPGRADE will be specified while defining the Alternate Index.

When UPGRADE is specified, any changes made in the base-cluster records will be reflected immediately in the AIX records. 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.

Update specifies that any changes made as a result of opening the AIX path name alone, without opening the base cluster, will be reflected in the AIX records.

38. What is an index set?

Index set is the other a part of the index. It has multiple levels with pointers that ultimately reach to the sequence set.

39. What is a sequence set?

Sequence set is the part of the index that points to the CA and CI of the record being accessed. Each CA will have a sequence set and the maximum key value in each CI of CA will be stored in the sequence set.

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

41. How many Alternate Indexes you can have on a dataset? - Remember ALT INDEX is possible only on KSDS and RRDS.

255 - but you must be a nut to have so many ALT Indexes on a dataset!

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

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.

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

RECOVERY (default) and SPEED are mutually exclusive. Recovery pre-formats 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 pre-format the CAs. It is recommended that you specify SPEED to speed up your initial data load.

44. What is a Base Cluser?

The Index and data components of a KSDS

45. 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).

46. What does the KEYRANGES parameter in Define Cluster command do?

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, concurrent access is possible, which is a performance improvement.

47. What are the optional parameters to the input dataset While loading the empty cluster with the data records?

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.

48. How many buffers are allocated to VSAM KSDS and ESDS?

2 data buffers by default for ESDS. For KSDS it allots 2 data buffers and 1 index buffers. each buffer is about 4k.

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

FREE SPACE(FPSC)

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

By USING RBA(Relative Byte Address).

51. How many times Secondary Space Allocated?

122 TIMES

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

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

54. What is File Status in VSAM?

The FILE STATUS clause of the FILE-CONTROL paragraph allows for each file to be associated with a file status key (i.e., the 2-character data item specified in the FILE STATUS clause). If the FILE STATUS clause is specified for a given file, a value indicating the status of each I/O operation against that file is placed in the associated file status key. This value is stored in the file status key as soon as the I/O operation is completed (and before execution of any EXCEPTION/ERROR declarative or INVALIDKEY/AT END phrase associated with the I/O request).

Note: This element may behave differently when the CMPR2 compiler option is used. The file status key is divided into two status keys: the first character is known as file status key 1; the second character is file status key 2.

Access Method Services (AMS)

55. What is AMS?

AMS is a set of Service Programs that helps to allocate, maintain and delete catalogues and datasets.

56. What is IDCAMS ?

IDCAMS is the Access Method Services program. You can run the IDCAMS program and supply AMS commands through SYSIN. (Examples of AMS commands are DELETE, DEFINE, REPRO etc.).

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

57. What are the IDCAMS commands that can be used for VSAM and explain each of them.

ALTER modifies information for a catalog, alternate index, cluster or path.

BLDINDEX builds the alternate index, of course.

DEFINE is used for defining the 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.

58. What is the syntax of AMS Modal Commands?

IF LASTCC(or MAXCC) >(or ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download