Vital Cobol Interview Preparation Guide
Download PDF

Cobol Interview Questions and Answers will guide us now that COBOL is one of the oldest programming languages in computer history. COBOL name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments. Learn COBOL programming basic and advance concepts or get preparation of COBOL based jobs interview by our this Cobol Interview Questions and Answers Guide.

110 Cobol Questions and Answers:

Table of Contents:

Vital  Cobol Job Interview Questions and Answers
Vital Cobol Job Interview Questions and Answers

1 :: What is the use of EVALUATE statement?

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.

2 :: How do you come out of an EVALUATE statement?

After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need of any extra code.

3 :: What is a scope terminator Give example?

Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.

4 :: When would you use in-line perform?

When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the program), it would be better to put the code in a separate Para and use PERFORM Para name rather than in-line perform.

5 :: What the difference is between CONTINUE and NEXT SENTENCE ?

They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would

take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if

sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 0

then next sentence end if display ‘line 1' display ‘line 2'. display ‘line 3'. Note- there is a dot (.) only at the end of the line.

6 :: How many bytes does a S9(7) COMP-3 field occupy?

It will take 4 bytes. Sign is stored as hex value in the last nibble. General formula is INT((n2) + 1)), where n=7 in this example.

7 :: What is Static and Dynamic linking?

In static linking, the called subroutine is link-edited into the calling program, while in dynamic linking, the subroutine & the main program will exist as separate load modules. You choose static dynamic linking by choosing either the DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a CALL literal), will translate to a DYNAMIC call).A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.

8 :: What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY) (applicable to only MVSESA Enterprise Server) ?

These are compile link edit options. AMODE stands for Addressing mode and RMODE for Residency mode.

AMODE(24) - 24 bit addressing;

AMODE(31) - 31 bit addressing

AMODE(ANY) - Either 24 bit or 31 bit addressing depending on RMODE.

RMODE(24) - Resides in virtual storage below 16 Meg line. Use this for 31-bit programs that call 24-bit programs. (OSVS Cobol pgms use 24-bit addresses only).

RMODE(ANY) - Can reside above or below 16 Meg line.

9 :: What is SSRANGE, NOSSRANGE?

These are compiler options with respect to subscript out of range checking. NOSSRANGE is the default and if chosen, no run time error will be flagged if your index or subscript goes out of the permissible range.

10 :: How do you set a return code to the JCL from a COBOL program?

Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.

11 :: How can you submit a job from COBOL programs?

Write JCL cards to a dataset with xxxxxxx SYSOUT= (A, INTRDR) where ‘A’ is output class, and dataset should be opened for output in the program. Define a 80 byte record layout for the file.

12 :: What are the differences between OS VS COBOL and VS COBOL II?

OSVS Cobol pgms can only run in 24-bit addressing mode, VS COBOL II pgms can run either in 24 bit or 31-bit addressing modes.

* I) Report writer is supported only in OSVS Cobol.
* II) USAGE IS POINTER is supported only in VS COBOL II.
* III) Reference modification e.g. WS-VAR(12) is supported only in VS COBOL II.
* IV) EVALUATE is supported only in VS COBOL II.
* V) Scope terminators are supported only in VS COBOL II.
* VI) OSVS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds.
* VII) Under CICS Calls between VS COBOL II programs are supported

13 :: What are the steps you go through while creating a COBOL program executable?

DB2 precompiled (if embedded SQL used), CICS translator (if CICS pgm), COBOL compiler, Link editor. If DB2 program, create plan by binding the DBRMs.

14 :: Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

In non-CICS environment, it is possible. In CICS, this is not possible.

15 :: What is an in line PERFORM When would you use it anything else to say about it?

The PERFORM and END-PERFORM statements bracket all COBOL II statements between them. The COBOL equivalent is to PERFORM or PERFORM THRU a paragraph. In line, PERFORM’s work as long as there are no internal GO TOs, not even to an exit. The in line PERFORM for readability should not exceed a page length - often it will reference other PERFORM paragraphs.

16 :: What COBOL construct is the COBOL II EVALUATE meant to replace?

EVALUATE can be used in place of the nested IF THEN ELSE statements.

17 :: Explain how to differentiate call by context by comparing it to other calls?

The parameters passed in a call by context are protected from modification by the called program. In a normal call, they can be modified.

18 :: Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc

An external sort is not COBOL; it is performed through JCL and PGM=SORT. It is understandable without any code reference. An internal sort can use two different syntax’s 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing; 2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.

19 :: What is the difference between comp and comp-3 usage Explain other COBOL usages?

Comp is a binary usage, while comp-3 indicates packed decimal. The other common usage’s are binary and display. Display is the default.

20 :: What is the default value(s) for an INITIALIZE? What keyword will allow for an override of the default?

INITIALIZE moves spaces to alphabetic fields and zeros to alphanumeric fields. The REPLACING option can be used to override these defaults.

21 :: What is the difference between a binary search and a sequential search what are the pertinent COBOL?

In a binary search, the table element key values must be in ascending or descending sequence. The table is ‘halved’ to search for equal to, greater than or less than conditions until the element is found. In a sequential search, the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, while sequential works well with smaller ones. SEARCH ALL is used for binary searches; SEARCH for sequential.

22 :: Why do we code S9 (4) comp. Inspite of knowing comp-3 will occupy less space?

Here s9(4)comp is small integer ,so two words equal to 1 byte so totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 12 byte.4 words equal to 2 bytes and sign will occupy 12 byte so totally it will occupy 3 bytes.

23 :: How do you differentiate between COBOL and COBOL-II?

The following features are available with VS COBOL II

1. MVSXA and MVSESA support the compiler and the object programs it produces can be run in either 24- or 31-bit addressing mode.

2. VMXA and VMESA support the compiler and the object programs it produces can be run in either24- or 31-bit addressing mode.

3. VSEESA supports the compiler and the object programs it produces can be run under VSEESA.

24 :: What is PERFORM what is VARYING?

The PERFORM statement is a PROCEDURE DIVISION statement which transfers control to one or more specified procedures and controls as specified the number of times the procedures are executed. After execution of the specified procedures is completed (i.e., for the appropriate number of times or until some specified condition is met), control is transferred to the next executable statement following the PERFORM statement. There are 5 types of PERFORM statements

* a) Basic PERFORM
* b) PERFORM TIMES
* c) PERFORM UNTIL
* d) PERFORM VARYING
* e) IN-LINE PERFORM

25 :: What is the difference between Structured COBOL Programming and Object Alternativelyiented COBOL?

Structured programming is a Logical way of programming, you divide the functionalities into modules and code logically. OOP is a Natural way of programming; you identify the objects first, and then write functions, procedures around the objects. Sorry, this may not be an adequate answer, but they are two different programming paradigms, which is difficult to put in a sentence or two.
Cobol Interview Questions and Answers
110 Cobol Interview Questions and Answers