Mainframe Interveiw question and answers | cobol Interview Question and answers
Hi welcome to Mainframe section Today i would like to share Cobol related interview question and answers.
Hi welcome to Mainframe section Today i would like to share Cobol related interview question and answers.
What
is COBOL Explain?
| ||
COBOL stands for Common
Business Oriented Language. It is a highlevel programming language first developed by CODASYL Committee (Conference on Data Systems Languages) in 1960. Since
then, the responsibility for developing new COBOL standards has been assumed by
American National Standards Institute (ANSI).
COBOL is designed for developing business, typically file-oriented,
applications. It is not designed for writing the system programs. For instance you
would not develop an operating system or compiler using COBOL.
| ||
Which
is First Executable Statement in COBOL ?
| ||
| ||
Compilation - starts from first line of the program | ||
Execution - starts from first line of the Procedure Division | ||
| ||
What
are Literals ? How many types of Literals are there ?
| ||
|
A literal is a data-item that consists only of the data-item value
itself. It's value remains unchanged throughout execution of the
program.
Types of Literals:
| |
String or Alphanumeric Literals - Example: “Hello “, “123.456” | ||
Numeric Literals For Example: 100.35, +66 | ||
| ||
What
are the Divisions Available in The COBOL?
| ||
Identification Division - It provides the information to the programmer
and the compiler.
|
||
Environment Division (optional) - It describes environment in which the program will be | ||
executed. | ||
Data Division - It provides data description which is to be processed by the program. | ||
Procedure Division - It consists of statements which are required in reading Input, processing | ||
it and writing the Output. | ||
The above four divisions must appear in same order in a COBOL programs. | ||
| ||
Define Paragraphs in Identification Division?
| ||
| ||
There are seven paragraphs in identification division of which only
one is mandatory and other six are optional paragraphs.
| ||
Program ID (mandatory) - It specifies name of the program and allocates the attributes to | ||
that particular program | ||
Author - It defines name of the programmer. It has no effect in the execution. | ||
Installation - It defines company and its location. It has no effect in the execution. | ||
Date Written - It defines date on which the program was written. It has no effect in the | ||
execution. | ||
Date Compiled - It defines date on which the program was compiled. | ||
Security - It shows level of confidentiality of the program. It has no effect in the execution. | ||
| ||
Define Sections in Environment Division?
|
||
| ||
Configuration Section - It consists of two paragraphs. They are
| ||
1) Source Computer - It specifies the computer on which the source program has to be | ||
compiled. | ||
2)Object Computer - It specifies the computer for which the object program has been | ||
designated. | ||
Input Output Section - It consists of two paragraphs. They are | ||
1) File Control - In this paragraph a file name is selected to be used in the program and is then | ||
assigned to a device. | ||
2) I-O Control - It provides information needed for efficient conveyance of data between the | ||
COBOL program and External File. | ||
| ||
Define Sections in the Data Division?
|
||
File section - It is used to define structure of data files. The data files could be Input or | ||
output or temporary files for sort/merge. | ||
Working-Storage section - It is used to describe records and data items. | ||
Linkage section - It is used to describe the data items that are referred by the called and calling | ||
programs. | ||
|
||
What
are Data-Names?
|
||
|
||
They are nothing but memory locations. They have to be described in Data
Division so that they can be used in Procedure Division.
|
||
|
||
What
are the Different Levels Available in the COBOL?
|
||
|
||
01-49 - Group or Elementary items | ||
66 - Renames Clauses | ||
77 - Independent Elementary data item | ||
88 - Condition Names | ||
| ||
What
are Group and Elementary Items?
|
||
|
||
A Group item is declared using a data name and a level number. It
cannot have a picture clause. If it is highest item in a data
hierarchy then, it is known as a record.
| ||
An Elementary item is used to describe data items. It consists of data name, level number and picture clause. | ||
Why
do we Debug Explain?
|
||
There
was an unexpected abend in the application
There is mismatch in the actual and expected results There was an evident logic error in the program There are performance issues |
||
What
are Two Basic Steps Involved in Debugging?
|
||
|
||
Finding the offending line number in the source code where the abend had occurred | ||
Finding the contents of the variable(s) at time of abend | ||
|
||
What are the Command Abend Codes ? | ||
SOC7 or Data
Exception
SOC4 or Storage Protection Exception |
||
Common reasons for SOC7 | ||
Evaluating a numeric data item with non-numeric value | ||
Numeric evaluations and conversions are done when using following COBOL statements: | ||
- COMPUTE, ADD, SUBTRACT, MULTIPLY, DIVIDE | ||
- MOVE, SET | ||
- IF, WHEN, EVALUATE | ||
Common reasons for SOC4 | ||
A program attempted to reference storage that had not been obtained | ||
Accessing an array that is out of range | ||
Moving (or copying) from a Source Field that is larger than the target | ||
|
Reading or
Writing a File that is not Opened
|
|
|
||
What is Difference Between COMP and COMP-3 ? | ||
COMP is used for the Binary Representation. It allows S and 9. | ||
S9(01) to S9(04) takes 2 Bytes of Memory | ||
S9(05) to S9(09) takes 4 Bytes of Memory | ||
S9(10) to S9(18) takes Bytes of Memory | ||
|
|
COMP-3 is used for the Packed Decimal values. It allows S, 9 and V. This is mainly used for Decimal |
Calculation Values. | ||
|
|
(n/2)+1 Bytes of Memory for Even Values of n. |
|
|
S9(05) to S9(09) takes 4 Bytes of Memory |
ConversionConversion EmoticonEmoticon