COBOL Interview Questions - 4

Question 31: What is the mode in which you will OPEN a file for writing? • GS
Answer : OUTPUT, EXTEND

Question 32: In the JCL, how do you define the files referred to in a subroutine
Answer : Supply the DD cards just as you would for files referred to in the main program.

Question 33: Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
Answer : Can rewrite (record length must be same), but not delete.

Question 34 : What is file status 92?
Answer : Logic error, e.g., a file is opened for input and an attempt is made to write to it.

Question 35 : What is the difference between PIC 9.99 and 9v99?
Answer : PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE- POSITION numeric field with implied or assumed decimal position.

Question 36 : What is Pic 9v99 Indicates?
Answer : PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position; the v means an implied decimal point.

Question 37 : What guidelines should be followed to write a structured Cobol prg'm? 
Answer :
1) use 'evaluate' stmt for constructing cases.
2) use scope terminators for nesting.
3) use in line perform stmt for writing 'do ' constructions.
4) use test before and test after in the perform stmt for writing do-while constructions.

Question 38: What happens when we move a comp-3 field to an edited (say z (9). ZZ-)
Answer :  The editing characters r to be used with data items with usage clause as display which is the default. When u tries displaying a data item with usage as computational it does not give the desired display format because the data item is stored as packed decimal. So if u want this particular data item to be edited u have to move it into a data item whose usage is display and then have that particular data item edited in the format desired.

Question 39: What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program ?
Answer : Both give the same results when a program is not calling any other program. GO BACK will give the control to the system even though it is a single program.

Question 40 : what is the difference between external and global variables?
Answer : Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.
1 2 3 4 5 6 7 8 9 10