COBOL Interview Questions - COBOL interview questions and answers by expert members with experience in COBOL subject. Discuss each question in detail for better understanding and in-depth knowledge of COBOL.
What is COBOL?
COBOL is abbreviated as Common Business Oriented Language and it is one of the oldest programming languages. It primarily used for business, finance and administrative systems for companies.

What are the different data types in COBOL?
There are three data types in Cobol:
  • Alpha-numeric (X)
  • Alphabetic (A) and
  • Numeric (9)
What is the difference between subscript and index?
Subscript refers to the occurrence of an array but index is the displacement from the beginning of the array.
An index can only be modified using PERFORM, SEARCH & SET.

What is 77 level used for?
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

What is 88 level used for?
For condition names.

What is level 66 used for?
For RENAMES clause.

What is file status 92?
Logic error. e.g., a file is opened for input and an attempt is made to write to it.

What is file status 39?
Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.
What is the difference between performing a SECTION and a PARAGRAPH?
SECTION will have all the paragraphs that are part of the section, to be performed.
PARAGRAPH will have only that paragraph to be performed.

What is the difference between CONTINUE & NEXT SENTENCE?
CONTINUE is like a null statement and it continues execution, while NEXT SENTENCE transfers control to the next sentence.

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.

What are the different OPEN modes available in Cobol?
Open modes can be used for
  • Input
  • Output
  • Input – Output
  • Extend
What is Static and Dynamic linking?
In static linking, called subroutine links into the calling program, while in dynamic linking, the subroutine & the main program will exist as separate modules. Dynamic and Static linking can be achieved by choosing either the DYNAM or NODYNAM link edit option.

What is the use of EVALUATE statement?
Evaluate is just like a case statement or it can be used like a Nested IFs. The difference between EVALUATE and case is that ‘break’ is not used in Evaluate statement and the control comes out of the EVALUATE once a match is found.

What is the point of the REPLACING option of a copy statement?
REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.

What kind of error is trapped by ON SIZE ERROR option?
ON SIZE ERROR option is raised when there is
  • fixed-point overflow
  • Zero raised to the zero power
  • Division by 0
  • Zero raised to a negative number
  • A negative number raised to a fractional power.
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
Structured programming is logical way of programming where the functionalities are divided into modules and helps write the code logically.
Object Oriented Cobol language is a Natural way of programming in which you identify the objects, and then write functions and procedures around that object.

What is the LOCAL-STORAGE section?
Local-Storage is allocated each time the program is called and will be de-allocated when the program stops via an EXIT PROGRAM, GOBACK, or STOP RUN. It is defined in the DATA DIVISION after WORKING-STORAGE SECTION

In the INPUT PROCEDURE, the input file is opened, records are read and edited and then are released to the sorting operation. Finally the file will be closed.
[plain]RELEASE recordname FROM inputrecord[/plain]
In the OUTPUT PROCEDURE, output file is opened, the sorted record is returned to the Output record and then the record will be written. Finally the file will be closed.
[plain]RETURN file RECORD into outputrecord[/plain]

What is the use of LINKAGE SECTION?
The linkage section is used to pass data from one program to another program or to pass data from a procedure to a program. It is part of a called program that maps to data items in the calling program’s working storage.

What are the access modes of START statement?
Access modes are SEQUENTIAL or DYNAMIC for the start statement.

Which division and paragraphs are mandatory for a COBOL program?
Identification division and Program ID are mandatory for a COBOL program.

What is the difference between Global and External Variables?
Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.

What is Pic 9v99 Indicates?
Pic 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position. Here, v means an implied decimal point.

What guidelines should be followed to write a structured COBOL program?
Following guidelines to be following while writing Cobol program:
  • Use ‘EVALUATE’ statement for constructing cases.
  • Use scope terminators for nesting.
  • Use in-line Perform statement for writing ‘do’ constructions.
  • Use Test Before and Test After in the Perform statement while writing Do-While statements.
What are all the divisions of a COBOL program?
There are four divisions in a cobol program:
  • Identification division
  • Environment division
  • Data division
  • Procedure division
What is COMP-1? COMP-2?
COMP-1 is a Single precision floating point and uses four bytes.
COMP2 is the double precision floating number and uses eight bytes.

What is the Purpose of Pointer in the string?
The Purpose of Pointer is to specify the leftmost position within receiving field where the first transferred character will be stored.

What are the different rules to perform a Search?
The SEARCH can be applied to a table
  • Which has OCCURS clause
  • INDEXED BY phrase
  • Search Index must have some initial value
  • Set the index value to 1
What are the different rules of SORT operation?
SORT can be performed when
  • Input and Output files must remain closed
  • Working file must have a select clause
  • Input and Output files have FD entries
  • Work file should have short description in File Section
When is a scope terminator mandatory?
Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements. Make scope terminator as explicit for good coding standards.
Why is it necessary that file needs to be opened in I-O mode for REWRITE?
Before the REWRITE is performed, the record must be open and read from the file. Therefore, the file must be opened in I-O mode for rewrite functionality.
How many Sections are there in Data Division?
There are six sections in Data Division:
  • File Section
  • Working Storage Section
  • Local Storage Section
  • Screen Section
  • Report Section
  • Linkage Section
What is the difference between comp and comp-3 usage?
Comp is for binary usage, while comp-3 indicates packed decimal.

What is the difference between Call and a Link?
A call is an actual COBOL command which provokes an external program and returns. Link is same as Call but it does not belong to a COBOL verb.
How arrays can be defined in COBOL?
Arrays can be defined as –
05 Array1 PIC X(9) which occurs 10 times
05 Array2 PIC X(9) which occurs 20 times

What are literals?
A literal is a data item which consists value by itself. It cannot be referred by a name. They are constant data items. There are two types of literals:
  • String / Alphanumeric Literals
  • Numeric Literals
What is a report item?
A report item is a field to be printed which has Edit Symbols.

What is the Difference between GOBACK, STOP RUN and EXIT PROGRAM in COBOL?
GOBACK returns control to the calling program
STOP RUN stops the current work unit and returns control to OS
EXIT PROGRAM is used to come out of a program that has been called by another program

When is INSPECT verb is used in COBOL?
INSPECT is used to know number of times a specific character occurs or to replace some portion of data.
Request to Download PDF


Vestibulum bibendum felis sit amet dolor auctor molestie. In dignissim eget nibh id dapibus. Fusce et suscipit orci. Aliquam sit amet urna lorem. Duis eu imperdiet nunc, non imperdiet libero.

Post A Comment: