Cobol Tough Questions (1 of 3)

Here is Cobol tough questions:

1. What is the relation between INITIAL and BY CONTENT?

When you choose to use the initial in the main program, which means whenever you invoke, its state comes to the initial – all the working storage values remain the same as before-and-after the call.

When you pass values to the sub-Program, by calling it using  BY CONTENT, see the below example, those values remain the same – not initialized.

Call ‘sub’ using by content A1 ==> Main Progrm

Procedure division using A1 ==> Sub program

2. When STRING is a pointer variable, how many non-black characters the variable WC-count will have? 

Move 1 to WC-count
String first-name delimited by ' '
Into Name-out
With POINTER WC-count.

3. The last statement in the called program is ‘EXIT PROGRAM’ or ‘GO BACK’?

Here is my previous post on Exit Program and Go BACK.

4. Array within the array?

01 Table occurs 10.
   03 field-1      pic xxx.
   03 sub1table    pic 9(5) occurs 5.
   03 field-2      pic 99.
It is then possible to refer to an entire record:
table (IDX)
or a field in it:
field-1 (IDX)
or a field in a sub-table:
sub-table (IDX1, IDX2).

Related posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

Comments are closed.