Wednesday, September 17, 2008

Cobol Interview Questions Part-9

140. Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?

Ans: Can rewrite(record length must be same), but not delete.

141.What is file status 92?

Ans: Logic error. e.g., a file is opened for input and an attempt is made to write to it.

142.What is file status 39?

Ans: Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.

143.What is Static, Dynamic linking ?

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

144.Explain NEXT and CONTINUE verbs for file handling.

Ans: A The Continue verb is used for a situation where there in no EOF condition. i.e. The records are to be accessed again and again in a file. Whereas in the next verb the indexed file is accessed sequentially, whence when index clause is accessed sequentially read next record command is used.

145. What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)? (applicable to only MVS/ESA).

Ans: These are compile/link edit options. AMODE - Addressing mode. RMODE - 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. (OS/VS Cobol pgms use 24 bit addresses only). RMODE(ANY) - Can reside above or below 16 Meg line.

146. What compiler option would you use for dynamic linking?



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

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

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

149. How can you submit a job from COBOL programs?

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

150. What are the differences between OS VS COBOL and VS COBOL II?


  1. OS/VS 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 allowing program to address above 16 Meg main storage line.
  2. Report writer is supported only in OS/VS Cobol.
  3. USAGE IS POINTER is supported only in VS COBOL II.
  4. Reference modification eg: WS-VAR(1:2) is supported only in VS COBOL II.
  5. COBOL II introduces new features (EVALUATE, SET ... TO TRUE, CALL ... BY CONTEXT, etc)
  6. Scope terminators are supported in COBOL II.
  7. OS/VS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds.
  8. Under CICS Calls between VS COBOL II programs are supported.
  9. COBOL II supports structured programming by using in-line PERFORM 's.
  10. COBOL II does not support old features (READY TRACE, REPORT-WRITER, ISAM, etc.).
  11. In non-CICS environment, it is possible. In CICS, this is not possible. 

No comments:

My Ad