VSAM Interview Questions & Answers

  1. Question 1. What Is Vsam?

    Answer :

    VSAM stands for Virtual Storage Access Method. It’s a Data Management method used to organize, store, catalog, retrieve and delete the datasets in mainframe system (VSAM and Non-VSAM). This access method makes it easier for an application to execute an I/O operation (moving data between an I/O device and memory). In fact VSAM is the first access method designed for Virtual Storage Environment.

    VSAM supports fixed as well as variable length records. These records are placed in blocks of Control Intervals and these control intervals are further placed as Control Area (CA consists of multiple CIs).

  2. Question 2. What Are The Advantages Of Vsam?

    Answer :

    • Accessing the data is faster and easier.
    •  VSAM supports more dataset types.
    • Supports variety of I/O Techniques.
    • Improves Efficiency.
    • Records can be accessed sequentially or randomly.
  3. IBM – VSAM Interview Questions

  4. Question 3. What Are The Disadvantages Of Vsam?

    Answer :

    • VSAM Datasets require more storage space compared to other type of datasets due to Control information(CI) present in them.
    • VSAM can’t be stored in TAPE Volume i.e., VSAM Stored only in DASD.
    • VSAM is not a database like DB2, IMS DB & IDMS.
  5. Question 4. What Is Purpose Of Vsam?

    Answer :

    VSAM acts as an interface between Application program & Operating System.

  6. File Maker Tutorial

  7. Question 5. What Is The Maximum Record Length For The Vsam Dataset?

    Answer :

    Max size of a record in VSAM is cylinder = 2880 bytes approx.

  8. JCL Interview Questions

  9. Question 6. What Is File Status In Vsam?

    Answer :

    The File STATUS clause of the FILE-CONTROL paragraph allows for each file to be associated with afile 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 accociated file status key. This value is stored in the file statuskey 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 statuskey is divided into two status keys: the first character is known as file status key1; the second character is file status key 2.

  10. Question 7. What Is The Length Of A Rdf?

    Answer :

    3 Bytes

  11. IBM DB2 Tutorial
    File Maker Interview Questions

  12. Question 8. What Is The Length Of A Cidf?

    Answer :

    4 Bytes

  13. Question 9. What Is The Maximum Size Of A Ci (control Interval)?

    Answer :

    32 KBytes (32 * 1024* 8)

  14. IBM DB2 Interview Questions

  15. Question 10. What Are The Different Types Of Vsam Files Available?

    Answer :

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

  16. COBOL Tutorial

  17. Question 11. What Is Idcams ?

    Answer :

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

  18. COBOL Interview Questions

  19. Question 12. Can Ams Commands Be Run From The Tso Prompt ?

    Answer :

    Yes

  20. IBM – VSAM Interview Questions

  21. Question 13. 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 ?

    Answer :

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

  22. IBM-JCL Tutorial

  23. Question 14. What Is Control Interval, Control Area ?

    Answer :

    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.

  24. Question 15. What Is Freespace ?

    Answer :

    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.

  25. IBM-JCL Interview Questions

  26. Question 16. How Do You Decide On Optimum Values For Ci, Freespace Etc..?

    Answer :

    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.

  27. DB2 Using SQL Tutorial

  28. Question 17. Would You Specify Freespace For An Esds?

    Answer :

    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.

  29. DB2 Using SQL Interview Questions

  30. Question 18. What Is Shareopts ?

    Answer :

    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 systemshare option ie how two or more jobs on different MVSes can share the file. Usual value is (2 3).

  31. JCL Interview Questions

  32. Question 19. What Is The Meaning Of Each Of The Values In Shareopts(2 3)?

    Answer :

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

  33. IBM Mainframe Tutorial

  34. Question 20. How Do You Define A Ksds ?

    Answer :

    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.

  35. IBM-JCL&VSAM Interview Questions

  36. Question 21. What Happens When You Open An Empty Vsam File In A Cobol Program For Input?

    Answer :

    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.

  37. Question 22. How Do You Initialize A Vsam File Before Any Operation? A Vsam With Alternate Index?

    Answer :

    Can write a dummy program that just opens the file for output & then closes it.

  38. IMS/DB Tutorial

  39. Question 23. What Does A File Status Of 02 On A Vsam Indicate?

    Answer :

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

  40. IBM Mainframe Interview Questions

  41. Question 24. What Is The Difference Between Sequential Files And Esds Files?

    Answer :

    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.

  42. File Maker Interview Questions

  43. Question 25. How Do You Load A Vsam Data Set With Records ?

    Answer :

    Using the REPRO command.

  44. Question 26. How Do You Define A Gdg ?

    Answer :

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

  45. COBOL, CICS, JCL, VSAM, DB2 Interview Questions

  46. Question 27. Do All Versions Of The Gdg Have To Be Of The Same Record Length ?

    Answer :

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

  47. IBM DB2 Interview Questions

  48. Question 28. How Are Different Versions Of Gdg Named ?

    Answer :

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

  49. Question 29. Suppose 3 Generations Of A Gdg Exist. How Would You Reference The 1 St Generation In The Jcl?

    Answer :

    Use GDG name(-2).

  50. Cisco Interview Questions

  51. Question 30. 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?

    Answer :

    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.

  52. Question 31. What More Info You Should Give In The Dd Statement While Defining The Next Generation Of A Gdg?

    Answer :

    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.

  53. Question 32. Assuming That The Define Jcl Is Not Available, How Do You Get Info About A Vsam File’s Organisation ?

    Answer :

    Use the LISTCAT command.

  54. IMS/DB Interview Questions

  55. Question 33. During Processing Of A Vsam File, Some System Error Occurs And It Is Subsequently Unusable .what Do You Do ?

    Answer :

    Run VERIFY.

  56. COBOL Interview Questions

  57. Question 34. 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.

  58. Question 35. What Is A Base Cluste?

    Answer :

    The Index and data components of a KSDS.

  59. Question 36. What Is The Rrn For The First Record In Rrds?

    Answer :

    1

  60. IBM-JCL Interview Questions

  61. Question 37. How Many Times Secondary Space Allocated?

    Answer :

    122 TIMES

  62. Question 38. What Is The Device Independent Method To Indicate Where A Record Is Stored?

    Answer :

    By USING RBA (Relative Byte Address).

  63. Question 39. What Is The Biggest Disadvantage Of Using A Vsam Dataset?

    Answer :

    FREE SPACE ( FPSC )

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

  65. DB2 Using SQL Interview Questions

  66. Question 41. What Is An Alternate Index And Path?

    Answer :

    An alternate index is an 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.

  67. Question 42. 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.

  68. IBM-JCL&VSAM Interview Questions

  69. Question 43. What Is The Difference Between Lds And Esds?

    Answer :

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

  70. Question 44. How To Delete A Member Using Jcl?

    Answer :

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

  71. Question 45. 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.

  72. Question 46. 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 begin copying at 9001 and copies 700 records from DD1 to DD2.

  73. Question 47. What Does The Keyranges Parameter In Define Cluster Commends 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, concurrent access is possible, which is a performance inprovement.

  74. Question 48. Describe Shareoptions Parameter (shr) In Define Cluster Command?

    Answer :

    It define 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 defualt is SHR(1 3).

  75. Question 49. What Is Recovery And Speed Parameters In Define Cluster Command?

    Answer :

    RECOVERY (default ) and SPEED are mutually exclusive. Recovery performats the control areas during the initial dataset load, if the job fails, you can restatt 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.

  76. Question 50. 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.

  77. Question 51. How Many Alternate Indexes You Can Have On A Dataset?

    Answer :

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

  78. Question 52. On Which Dataset You Can Have Alt Index?

    Answer :

    only on KSDS and ESDS – not RROS

  79. Question 53. What Is The Meaning Of Vsam Return-code 28?

    Answer :

    Out of space condition is raised.

  80. Question 54. How Do You Fix The Problem Associated With Vsam Out Of Space Condition?

    Answer :

    Define new VSAM dataset allocated with more space.
    Use IDCAMS to REPRO the old VSAM file to new VSAM dataset.
    Use IDCAMS to ALTER / rename the old VSAM dataset or se IDCAMS to DELETE the old VSAM datset.
    Use IDCAMS to ALTER / rename the new VSAM dataset to the name of the original VSAM dataset.

  81. Question 55. During Processing Of A Vsam File, Some System Error Occurs And It Is Subsequently Unusable What Do You Do?

    Answer :

    Run VERIFY.

  82. Question 56. How Are Different Versions Of Gdg Named?

    Answer :

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

  83. Question 57. How Do You Define A Gdg?

    Answer :

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

  84. Question 58. How Do You Calculate Record Size Of An Alternate Cluster? Give Your Values For Both Unique And Nonunique?

    Answer :

    UniqueCase: 5 + (alt-key-length + primary – key )
    Non unique Case: 5 + (alt-key-length + n * primary – key ) where n = number of duplicate records for the alternate key.

  85. Question 59. How Do You Load A Vsam Data Set With Records?

    Answer :

    Using the REPRO command.

  86. Question 60. Do All Versions Of The Gdg Have To Be Of The Same Record Length?

    Answer :

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

  87. Question 61. Suppose 3 Generations Of A Gdg Exist. How Would You Reference The 1st Generation In The Jcl?

    Answer :

    Use GDG name(-2).

  88. Question 62. Assuming That The Define Jcl Is Not Available, How Do You Get Info About A Vsam Files Organisation?

    Answer :

    Use the LISTCAT command.

  89. Question 63. Using Alternate Indexes In Cics Program?

    Answer :

    FCT entires must be created for both base cluster and the path. To read using the alternate index, use the DD name of the path in CICS file control commands.

  90. Question 64. Using Alternate Indexes In Batch Program?

    Answer :

    In the JCL, you must have DD statements for the cluster and for the path9s). In the COBOL program, SELECT … ASSIGN TO ddname for base cluster RECORD KEY IS… ALTERNATE RECORD KEY IS.

  91. Question 65. What Is A Lds (linear Data Set) And What Is It Used For?

    Answer :

    LDS is a VSAM dataset in name only. It has unstructured 4k (4096 bytes ) fixed size CT’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.

  92. Question 66. What Is The Meaning Of The Define Model Parameter?

    Answer :

    It specifies whether Daniela Pestova or Yamila – oops! Wrong models! The MODEL parameter allows you to model your cluster by modeling it after an existing cluster.

  93. Question 67. What Are The Three Levels Of Definition For The Vsam Define?

    Answer :

    They are DEFINE CLUSTER, DATA and INDEX.

  94. Question 68. What Is The Utility Program Closely Associated With Vsam?

    Answer :

    IDCAMS, the access mehtod services utility.

  95. Question 69. What Is The Vsam-code Field?

    Answer :

    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.

  96. Question 70. What Is The Meaning Of Dynamic Processing?

    Answer :

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

  97. Question 71. 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?

    Answer :

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

  98. Question 72. Would You Specify Freespace Ce For An Esds?

    Answer :

    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.

  99. Question 73. What Is The Meaning Of Each Of The Values In Shareopts (2 3)?

    Answer :

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

  100. Question 74. How Do You Define An Altindx? How Do You Use Altindxs In Batch, Cics Programs?

    Answer :

    DEFINE ALTERNATEINDEX. Important parameters are RELATE where you specify the base cluster name, KEYS, RECORDSIZE, SHAREOPTION, 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 vase cluster takes place. Then BLDINDEX. Paramters are INDATASET (DS name of base cluster), OUTDATASET (DS name of AIX).

  101. Question 75. Name Some Common Vsam Error Conditions And Codes?

    Answer :

    They are end of file (10), duplicate key (22), record not found (23), VSAM logic error (90), open problem (92) and space problem (93).

  102. Question 76. What Is A Vsam Slot?

    Answer :

    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.

  103. Question 77. There Are At Least Seven Idcams Commands Name And Explain Each Of Them?

    Answer :

    ALTER modifies information for a catalog, alternate index, cluster or path. BLDINDEX builds the alternate index, of course. 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.

  104. Question 78. What Is The Significance Of The Shareoptions Parameter?

    Answer :

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

  105. Question 79. If You Wish To Use The Rewrite Command How Must The Vsam File Be Opened?

    Answer :

    It must be opened as I/O.

  106. Question 80. What Is The Cobol Record Key Clause?

    Answer :

    The RECOED KEY in the SELECT clause identifies the files primary key as it will be known to the program.

  107. Question 81. In The Cobol Select Statement What Is The Organization For A Ksds?

    Answer :

    The ORGANIZATION is INDEXED.

  108. Question 82. What Is The Base Cluster?

    Answer :

    The base cluster consists of the data component and the index component for the primary index of a KSDS.

  109. Question 83. What Is Free Space?

    Answer :

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

  110. Question 84. What Is A Path?

    Answer :

    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.

  111. Question 85. What Is A Ci, Control Interval?

    Answer :

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

  112. Question 86. What Is A Ca, Control Area?

    Answer :

    A group of control intervals makes up a control area.

  113. Question 87. What Is The Index Set?

    Answer :

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

  114. Question 88. What Is The Catalog?

    Answer :

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

  115. Question 89. What Is The Purpose Of The File Status Clause In The Select Statement?

    Answer :

    The FILE STATUS field identifies the field that VSAM uses to provide information about each I/O operation for the file.

  116. Question 90. In The Cobol Select Statement For A Ksds What Are The Three Possibilities For Access?

    Answer :

    ACCESS can be SEQUENTIAL, RANDOM or DYNAMIC.

  117. Question 91. Do Primary Key Values Have To Be Unique? Do Alternate Key Values Have To Be Unique?

    Answer :

    Primary key values must be unique; alternate key values need not be.

  118. Question 92. What Is A Vsam Split?

    Answer :

    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.

  119. Question 93. What Is The Upgrade Set?

    Answer :

    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.

  120. Question 94. What Is An Alternate Index?

    Answer :

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

  121. Question 95. What Is A Cluster?

    Answer :

    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.

  122. Question 96. What Is A Sequence Set?

    Answer :

    This is the part of the index that points to the CA and CI of the record being accessed.

  123. Question 97. What Are The Distinctive Features Of A Ksda, Key Sequenced Dataset?

    Answer :

    The index and the distributed free space.

  124. Question 98. How Are Records Stored In An Esds, Entry Sequenced Dataset?

    Answer :

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

  125. Question 99. What Are The Types Of Vsam Datasets?

    Answer :

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

  126. Question 100. Syntax Of Ams Modal Commands?

    Answer :

    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.