COBOL Interview Questions and Answers
Ques 41. Explain the concept of the INDEX in COBOL.
The INDEX in COBOL is a special register that is used to store the position within a table. It is often manipulated using the SET and PERFORM statements.
Example:
SET TABLE-INDEX TO 1.
Ques 42. What is the purpose of the EXIT PARAGRAPH statement?
The EXIT PARAGRAPH statement in COBOL is used to exit a specific paragraph prematurely. It is useful for controlling the flow within a section of code.
Example:
PERFORM PROCESS-DATA.
IF ERROR-FLAG = 'Y' THEN
EXIT PARAGRAPH.
END-IF.
Ques 43. Explain the concept of the SET ENVIRONMENT statement.
The SET ENVIRONMENT statement in COBOL is used to specify or change environment settings, such as the currency symbol, decimal point character, or date format.
Example:
SET ENVIRONMENT CURRENCY-SYMBOL '$'.
Ques 44. What is the purpose of the USE statement in COBOL?
The USE statement in COBOL is used to declare and specify the usage of indexes in a SEARCH statement. It associates an index with a table to optimize search operations.
Example:
USE EMPLOYEE-INDEX.
Ques 45. Explain the concept of the ACCEPT FROM statement.
The ACCEPT FROM statement in COBOL is used to receive data directly from an external device, such as a keyboard. It simplifies interactive input operations.
Example:
ACCEPT WS-EMPLOYEE-ID FROM 'Enter Employee ID:'.
Most helpful rated by users: