Saturday 10 April 2021

COBOL Interview Questions | 10 Incredible COBOL Interview Questions and Answers [COBOL Interview]

COBOL Interview Questions, COBOL Interview Questions and Answers

COBOL Interview Questions.


Welcome back to the "COBOL Interview Question" session. In this session, you'll go through COBOL interview questions and answers from different COBOL topics. These top 10 COBOL interview questions also include scenario-based questions. Let's get started with Introduction to COBOL. 


Introduction to COBOL. 

The term COBOL stands for COmmon Business Oriented Language. COBOL is one of the oldest and mature programming languages. COBOL is a robust, simple, and powerful programming language. COBOL has a proven track record of 60 years and COBOL still dominates enterprise computing. 

Now, let's get started with the top 10 COBOL Interview Questions and Answers.  

What is the difference between COBOL COPY and COBOL CALL Statements?

  • The COPY statement is used to bring into a program a source member consisting of a series of prewritten COBOL statements.
  • The CALL statement transfers control from one program to another. The main program containing the CALL statement that references or calls a program is referred to as the calling program.

What is the purpose of the PROGRAM-ID and in which division it is defined?

  • PROGRAM-ID parameter is defined in the IDENTIFICATION DIVISION.
  • It is used to specify the name of the COBOL program. It can consist of 1 to 30 characters.

How many divisions does a COBOL Program contain? Can you name each division?

A COBOL program has four divisions:
  • Identification Division.
  • Environment Division.
  • Data Division.
  • Procedure Division.

What is the difference between a level 77 item and a level 01 item with no subordinate levels?

Well, The two items are functionally the same. Both are elementary level items if the 01 level does not have any subordinate items (i.e. Group fields). If 01 is defined as a group field then it would be different from level 77. Another difference is that an 01 level is aligned on a double word boundary, whereas a 77 level is unaligned. 
  • 01 EMP-NAME       PIC X(35).
  • 77 EMP-ADD        PIC X(40).

When using Declarative, can you perform another paragraph with the declarative area?

Yes, you can have a common error paragraph within the declarative that is executed. However, you must not Perform any paragraph outside the declarative.

Which statement is coded to update the record in a sequential file? What has specified with the statement: the record description or the file name?

The COBOL REWRITE Statement is used to update the record. The record description is specified in the REWRITE statement, instead of the file name.

REWRITE in COBOL Example. 

REWRITE EMP-REC FROM WS-EMP-REC
END-REWRITE.

Is the At End clause valid when issuing a Random Read?

No. You cannot use the "At End Clause" because you are reading records directly via key. You'll never have an end-of-file condition in such a scenario. However, you should code Invalid Key Clause to handle "record not found" - File status 23.

COBOL REWRITE Example. 

READ EMP-REC INTO WS-EMP-REC
     INVALID KEY
             DISPLAY “EMP REC NOT FND"
             DISPLAY "FLE ST CDE:“ WS-STAT-CDE
END-READ.


If a file is defined as optional and it doesn’t exist, which file status is returned if the file is opened Input? What about Output?

The input file status code would be 05. An OPEN statement was successfully executed, but the referenced optional file was unavailable at the time the OPEN statement was executed. The output file status code would 00.

COBOL OPEN Statement Example: 

READ EMP-REC INTO WS-EMP-REC 
     INVALID KEY 
         DISPLAY 'EMP REC NOT FND'
END-READ.

In which mode must you open a file to update the record in the file?

If you want to update data in the file, then it should be opened in I-O mode (i.e. Input-Output Mode). Make sure you read the record from the file before updating the record in the file. 
 
COBOL OPEN Statement Example: 

 OPEN I-O EMPFILE.

How do you read records from the file and what must be done before you can read records from a file?

The record from the file is read by using the COBOL READ statement. You should open the input file in the desired mode by using the COBOL OPEN Statement before reading records from the file. 

COBOL OPEN Statement Example: 

 OPEN INPUT EMPFILE.

COBOL Interview Question - You tube.



Conclusion. 

Finally, this marks an end to the COBOL Interview Questions and answers. These interview questions are designed for both experienced and fresher. With the help of these COBOL interview Questions, you can easily clear your interview questions. Do check out COBOL LEVEL 88 Condition.


Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. Also, Please visit mention the link below to stay connected with Topictrick and the Mainframe forum on - 

► Youtube
► Facebook 
► Reddit

Thank you for your support. 
Mainframe Forum™

No comments:

Post a Comment

New In-feed ads