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 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?

Ans:

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.