Thursday, December 8, 2011

COBOL: Interview questions


  1. How to pass return code program to JCL ?.
ANS : MOVE 8 to RETURN-CODE.

RETURN-CODE is a registor.

  1. Program 1 calls Program 2 and passes no data. Do we need to code Linkage section in
Program 2.

ANS : No need to code.

  1. Variable 1 is defined in Working-storage section. Is the following statement true for variable 1.
SET ADDRESS OF variable 1 TO NULL.

ANS : Only linkage section variables has addressability. The statemnt will result in compilation
Erros.

  4. 01 WS-DATA.
        05 WS-CNTR PIC 9(2).
        05 WS-data1.
  10 WS-data2 occurs 1 to 99 times depending on WS-CNTR PIC X(10).
        05 WS-data3 PIC X(10).

     Procedure division.
         MOVE “DATA” TO ws-data3
         Display ws-data3.
         Stop run

     What will be result ?.

     ANS : We should first set a value to “WS-CNTR”. Otherwise ws-data3 will not be allocated.

5.
    PERFORM para-1 thru para5.
Display “Control is resuming”.
STOP RUN.

PARA1.
.
.
Go to para4.
Para 2.
.
.
.
Para 4.
.
.
.
para 5.
.
.
.


Will the control will go to “DISPLAY” statement.

ANS : Yes.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.