Mainframe Cobol Interview Questions

Mainframe Cobol Interview Questions

Online Training Mainframes1. Name the divisions in a COBOL program?

ANS: Identification division, Environment division, data division, Procedure division.

2. What are the different data types available in COBOL?

ANS: Alpha-numeric (X), alphabetic (A) and numeric (9).

3. What does the INITIALIZE verb do?

ANS: Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES.
Numeric, Numeric edited items set to ZERO.
Filter occurs depending on items left untouched

4. What is 77 level used for?

Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

5. What does the IS NUMERIC clause establish?

ANs: IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and – .

6. How do you define a table/array in COBOL?




7. What is the difference between index and subscript?

ANS: Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & SET.

Need to have index for a table in order to use SEARCH, SEARCH ALL.

What is the difference between SEARCH and SEARCH ALL?

SEARCH – is a serial search.

SEARCH ALL – is a binary search & the table must be sorted (ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.

8. What should be the sorting order for SEARCH ALL?

It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).

9. How is sign stored in a COMP field?

ANS: In the most significant bit. Bit is on if -ve, off if +ve.

10. What are the different data types available in COBOL?

ANS: Alpha-numeric (X) , Alphabetic (A) and numeric (9).

11. Significance of the COMMON Attribute?

ANS: COMMON attribute is used with nested COBOL programs. If it is not specified, other nested programs will not be able to access the program. PROGRAM-ID. Program name is COMMON PROGRAM.

12. What is binary search?

ANS: Search on a sorted array. Compare the item to be searched with the item at the center. If it matches, fine else repeat the process with the left half or the right half depending on where the item lies.

My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the 11th item in this array, the program does not abend. What is wrong with it?

Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.

13. How do you define a sort file in JCL that runs the COBOL program?

ANS: Use the SORTWK01, SORTWK02 … dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.

14. What is the use of EVALUATE statement?

ANS: Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and case is that no ‘break’ is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is made.

15. What are different file OPEN modes available in COBOL?


16. What is the mode in which you will OPEN a file for writing?


17. What are the steps you go through while creating a COBOL program executable?

ANS: DB2 precompiler (if embedded sql used), CICS translator (if CICS pgm), Cobol compiler, Link editor.

If DB2 program, create plan by binding the DBRMs.

For Mainframes Online training please log on to