Warning: main(Menu/TopMenu.php) [function.main]: failed to open stream: No such file or directory in /home/jhingala/public_html/cobol-interview-questions.php on line 29

Warning: main() [function.include]: Failed opening 'Menu/TopMenu.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/jhingala/public_html/cobol-interview-questions.php on line 29

Cobol Interview Questions




Q:

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

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

Q:

What is SSRANGE, NOSSRANGE ?

A: These are compiler options w.r.t 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.

Q:

What is 77 level used for ?

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

Q:

What is 88 level used for ?

A: For condition names.

Q:

What does the IS NUMERIC clause establish ?

A: IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and usigned 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 - .

Q:

Can the OCCURS clause be at the 01 level?

A: NO

Q:

What is the difference between index and subscript?

A: 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.


Q:

What is the difference between SEARCH and SEARCH ALL?

A: 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.


Q:

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 error. What is wrong with it?

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

Q:

How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning.

A: Syntax:

SORT file-1 ON ASCENDING/DESCENDING KEY

USING file-2

GIVING file-3.

USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2

GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.

file-1 is the sort workfile and must be described using SD entry in FILE SECTION.

file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL.

file-3 is the outfile from the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL.

file-1, file-2 & file-3 should not be opened explicitly.

INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.

OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.


Q:

What is a scope terminator?

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

Q:

What is the difference between CONTINUE & NEXT SENTENCE ?

A: CONTINUE is like a null statement (do nothing) , while NEXT SENTENCE transfers control to the next sentence

Q:

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

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

If DB2 program, create plan by binding the DBRMs.


Q:

What are the different data types available in COBOL?

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

Q:

When would you use in-line perform?

A: 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 paraname rather than in-line perform.

Q:

What do you do to resolve SOC-7 error?

A: Basically you need to correct the offending data.
Many times the reason for SOC7 is an un-initialized numeric item.
Many installations provide you a dump for run time abends. These dumps provide the offset of the last instruction at which the abend occurred. Examine the compilation output XREF listing to get the verb and the line number of the source code at this offset. Then you can look at the source code to find the bug. To get capture the runtime dumps, you will have to define some datasets (SYSABOUT etc ) in the JCL.

Some installtion might have batch program debugging tools.


Q:

What does the INITIALIZE verb do?

A: Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES.

Numeric, Numeric edited items set to ZERO.

FILLER , OCCURS DEPENDING ON items left untouched.


Q:

Name the divisions in a COBOL program.

A: Identification Division, Environment Division, Data Division, Procedure Division.



Mainframe / COBOL Interview Questions