COBOL is a high-level programming language first developed by the CODASYL Committee (Conference on Data Systems Languages) in 1960. The word COBOL is an acronym that stands for COmmon Business Oriented Language. As the the expanded acronym indicates, COBOL is designed for developing business, typically file-oriented, applications. It is not designed for writing systems programs. For instance you would not develop an operating system or a compiler using COBOL.The COBOL 2002 standard includes support for object-oriented programming and other modern language features.
COBOL Interviews are getting tough these days as the technology grows faster. To get through the COBOL interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed COBOL questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on COBOL and various other technologies interview preparation.
11. Give some advantages of REDEFINES clause.
You can REDEFINE a Variable from one PICTURE class to another PICTURE class by using the same memory location. By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself. We can REDEFINE a Single Variable into so many sub variables. (This facility is very useful in solving Y2000 Problem.)
12. 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)
13. How can you submit a job from COBOL programs?
Write JCL cards to a dataset with //xxxxxxx SYSOUT= (A,INTRDR) where 'A' is output class, and dataset should be 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.
14. How do we get current date from system with century?
By using Intrinsic function, FUNCTION CURRENT-DATE
15. 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?
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.
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.
16. How do you come out of an EVALUATE statement?
After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need of any extra code.
17. How do you declare a host variable (in COBOL) for an attribute named Emp-Name of type VARCHAR(25) ?
01 EMP-GRP. 49 E-LEN PIC S9(4) COMP. 49 E-NAME PIC X(25).
18. How do you define a sort file in JCL that runs the COBOL program?
Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.
19. How do you define a table/array in COBOL?
ARRAYS.
05 ARRAY1 PIC X(9) OCCURS 10 TIMES.
05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.
05 ARRAY1 PIC X(9) OCCURS 10 TIMES.
05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.
20. How do you define a variable of COMP-1? COMP-2?
No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.