Wednesday, May 23, 2012

Cobol Interview Questions 5

What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program i.e. aprogram which is not calling any other program. ?
The program will go in an infinite loop.

How can I tell if a module is being called DYNAMICALLY or STATICALLY ?
The ONLY way is to look at the output of the linkage editor (IEWL)or the load module itself. If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be seen in the load module.
Calling a working storage variable, containing a program name, does not make a DYNAMIC call. This type of calling is known as IMPLICITE calling as the name of the module is implied by the contents of the working storage variable. Calling a program name literal (CALL

What is the difference between a DYNAMIC and STATIC call in COBOL. ?
To correct an earlier answer: All called modules cannot run standalone if they require program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect u address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.

How may divisions are there in JCL-COBOL ?
SIX

What is the purpose of Identification Division ?
Documentation.

What is the difference between PIC 9.99 and 9v99 ?
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.

What is Pic 9v99 Indicates ?
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.

What guidelines should be followed to write a structured Cobol prg'm ?
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.

Read the following code.
01 ws-n pic 9(2) value zero.

a-para. move 5 to ws-n.
perform b-para ws-n times.
b-para. move 10 to ws-n.

How many times will b-para be executed ?
5 times only. it will not take the value 10 that is initialized in the loop.

What is the difference between SEARCH and SEARCH ALL ? What is more efficient ?
SEARCH is a sequential search from the beginning of the table. SEARCH ALL is a binary search, continually dividing the table in two halves until a match is found. SEARCH ALL is more efficient for tables larger than 70 items.

What are some examples of command terminators ?
END-IF, END-EVALUATE

What care has to be taken to force program to execute above 16 Meg line ?
Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never have SIZE(MAX). BUFSIZE can be 2K, efficient enough.

How do you submit JCL via a Cobol program ?
Use a file //dd1 DD sysout=(*, intrdr)write your JCL to this file. Pl some on try this out.

How to execute a set of JCL statements from a COBOL program?
Using EXEC CICS SPOOL WRITE(var-name) END-EXEC command. var-name is a COBOL host structure containing JCL statements.

Give some advantages of REDEFINES clause. ?
1. You can REDEFINE a Variable from one PICTURE class to another PICTURE class by using the same memory location.
2. By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself.
3. We can REDEFINE a Single Variable into so many sub variables. (This facility is very useful in solving Y2000 Problem.)

What is the difference between static call & Dynamic call?
In the case of Static call, the called program is a stand-alone program, it is an executable program. During run time we can call it in our called program. As about Dynamic call, the called program is not an executable program it can executed through the called program

What do you feel makes a good program ?
A program that follows a top down approach. It is also one that other programmers or users can follow logically and is easy to read and understand.

How do you code Cobol to access a parameter that has been defined in JCL ? And do you code the PARM parameter on the EXEC line in JCL ?
1) using JCL with sysin. //sysin dd *here u code the parameters(value) to pass in to cobol program /* and in program you use accept variable name(one accept will read one row)/.another way.
2) in jcl using parm statement ex: in exec statement parm='john','david' in cobol pgm u have to code linkage section in that for first value you code length variable and variable name say, abc pic x(4).it will take john inside to read next value u have to code another variable in the same way above mentioned.

Why do we code S9(4) comp. Inspite of knowing comp-3 will occupy less space. ?
Here s9(4)comp is small integer ,so two words equal to 1 byte so totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 1/2 byte.4 words equal to 2 bytes and sign will occupy 1/2 byte so totally it will occupy 3 bytes.

The maximum number of dimensions that an array can have in COBOL-85 is ----------- ?
SEVEN in COBOL - 85 and THREE in COBOL - 84

1 comment:

  1. Good list.Please refer http://clearmainframeinterview.blogspot.in/
    for more interview questions on COBOL,JCL,DB2 and IMS.

    ReplyDelete