Cobol by Java Tpoint
Cobol by Java Tpoint
⇧ SCROLL TO TOP
https://www.javatpoint.com/cobol-tnterview-questions 1/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
COBOL is an abbreviation that stands for Common Business Oriented Language. It is one of the
oldest programming languages and is primarily used for business verticals, including government
companies' functions, finance, and administrative systems. It is a weak, static typing discipline
language. COBOL programming language is mainly used for large-scale batch and transaction
processing jobs and solving complex business problems.
It is a fact that COBOL is one of the oldest programming languages, but you cannot say that it is an
outdated programming language. It is still used, and yes, it is still worth learning. It is up to the
users or programmers who want to maintain them or port them to other programming languages.
COBOL facilitates a lot of things to do easily. It is a more than 60 years old programming language,
but recently, there is a rise in demand for this language due to the requirements of some
government agencies and projects. Nowadays, COBOL is used in many government projects, and
programmers use it in many state government operations.
In 1959, the USA Government's Department of Defense formed CODASYL, an acronym for
Conference on Data Systems Language. The main motive behind forming the CODASYL was to
develop a computer programming language known as COBOL. The main purpose of this language
was to meet business, administrative, finance needs. It is a simple language that works on easy
English terms and phrases so that business users understand it easily and fulfil their data processing
needs through COBOL.
https://www.javatpoint.com/cobol-tnterview-questions 2/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
Alpha-numeric (X): The alpha-numeric data type can hold both values together, either
alphabetic or numeric.
Alphabetic (A): The alphabetic data type of COBOL programming language can hold any of
the alphabetic variables ranging between A-Z.
Numeric (9): The numeric data type represents numeric values between 0-9 in COBOL
programming.
The main difference between subscript and index is that the subscript is called the occurrence of an
array. On the other hand, index refers to the displacement from the beginning of the array. An index
can only be modified using PERFORM, SEARCH & SET.
COBOL is a standard programming language that can be compiled and executed on various
machines.
COBOL is a structured language that has different divisions, so debugging is easy in COBOL.
AD
https://www.javatpoint.com/cobol-tnterview-questions 3/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
Identification Division
Environment Division
Data Division
Procedure Division
In the COBOL programming language, a section consists of all the paragraphs that are part of the
section and must be performed. On the other hand, a paragraph consists of only that paragraph
that has to be performed.
9) What is the 'IS NUMERIC' clause? / What do you understand by the 'IS
NUMERIC' clause in COBOL?
In the COBOL programming language, the 'IS NUMERIC' clause is used to check if an item is
numeric or not. It returns the value as TRUE if the checked item contains only numbers (0 to 9). The
item can be positive or negative.
10) What are level 66 and level 88 in the COBOL programming language?
In the COBOL programming language, level 66 is used in RENAMES clause, and level 88 is used for
condition names.
In COBOL, the scope terminator is used to mark the end of a verb. For example, IF and END-IF.
12) What is the difference between SEARCH and SEARCH ALL in COBOL?
In COBOL, the SEARCH command is used for serial search while the SEARCH ALL command is used
for binary search where the table or array must be sorted using ASCENDING or DESCENDING key.
https://www.javatpoint.com/cobol-tnterview-questions 4/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
The NEXT SENTENCE transfers control to the next sentence while the CONTINUE acts like a null
statement, and it continues execution.
Input
Output
Input-Output
Extend
15) What is the maximum size of a numeric field that can be defined in
COBOL?
The maximum size of a numeric field that can be defined in COBOL is PIC 9(18).
AD
16) What is the difference between Static Linking and Dynamic Linking in
COBOL?
In Static linking, the subroutine links into the calling program. On the other hand, in the dynamic
linking, the key program and subroutine will remain separate modules. Static linking and dynamic
linking can be achieved by link edit options- DYNAM or NODYNAM.
17) What are the main characteristics of the COBOL programming language
as a business language?
machines together. It can also be used for debugging and testing tools if it is required a debugging
solution. Different versions of COBOL can enhance its features many times.
In COBOL, the EVALUATE statement is just like a case statement. It can also be used like a Nested IF.
The main difference between an EVALUATE statement, and a case is that 'break' is not used in
Evaluate statement, and the control comes out of the EVALUATE once a match is found.
While writing a structured COBOL based program, we must follow a certain format that allows the
proper implementation of the code. For example, while constructing a case, we can use
EQUIVALENT statements each time. While nesting, we should use scope terminators, and when we
want the program to do something, we should try and use IN-LINE PERFORM statements. We can
also use TEST BEFORE and TEST AFTER statements while coding for do-while loop statements.
20) What is the difference between PERFORM ... WITH TEST AFTER and
PERFORM ... WITH TEST BEFORE?
PERFORM … WITH TEST BEFORE: If TEST BEFORE is specified, the condition is tested at the
beginning of each repeated execution of the specified PERFORM range.
AD
PERFORM … WITH TEST AFTER: If TEST AFTER is specified, the condition is tested at the end of
each repeated execution of the PERFORM range. The range is executed at least once in TEST AFTER.
In the COBOL programming language, the REPLACING option allows for the same copy to use many
times if required. It changes the replace value in the same code.
Syntax:
https://www.javatpoint.com/cobol-tnterview-questions 6/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
COPY <Name> REPLACING BY
In the COBOL programming language, the scope terminator is used to mark the end of a verb.
We cannot define an Occurs clause at 01 levels because 01 is record level. We repeat the fields
within a record, but not the record itself. So, we cannot use the Occurs clause at the 01 levels.
24) What is the role of the ON SIZE ERROR option in trapping error? /
What kinds of errors are caught by the ON SIZE ERROR option?
The ON SIZE ERROR option is used to trap the following types of errors:
Division by zero
25) What is the difference between the structured COBOL program and the
Object-Oriented COBOL Program?
Structured programming is the logical way of writing a program where functions are divided into
modules and operated logically. COBOL is a structured and very user-friendly programming
language. It is one of the oldest programming languages. The functionalities it provides for big
administrative systems cannot be easily replaced. That's why it is alive and used nowadays also
although it was invented a long ago.
https://www.javatpoint.com/cobol-tnterview-questions 7/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
The sorting order for SEARCH ALL can be either ASCENDING or DESCENDING. By default, it is
ascending. If you want the search to be done on an array sorted in descending order, then you
should give DESCENDING KEY clause while defining the array. It means you must load the table in
the specified order.
28) What is the difference between Call By Content and Call By Reference
in COBOL?
In Call By Content, the passed parameters are protected from modification by the called program.
On the other hand, in Call By Reference, the called program can modify the parameters.
In INPUT PROCEDURE, the input file is opened, records are read and edited and then are released to
the sorting operation. In the end, the file will be closed.
[plain]RELEASE recordname FROM inputrecord[/plain]
In the OUTPUT PROCEDURE, the output file is opened, the sorted record is returned to the Output
record, and the record will be written. In the end, the file will be closed.
https://www.javatpoint.com/cobol-tnterview-questions 8/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
[plain]RETURN file RECORD into outputrecord[/plain]
30) What is the difference between Call By Content and Call By Reference
in COBOL?
In Call By Content, the passed parameters are protected from modification by the called program.
On the other hand, in Call By Reference, the called program can modify the parameters.
In COBOL programming, the linkage section is used to pass data from one program to the other or
pass data from a procedure to a program. It is part of a program that maps data items in the calling
program's working storage.
32) What are the different access modes of the START statement?
There are two access modes in the START statement: SEQUENTIAL and DYNAMIC.
FILE Section
WORKING-STORAGE Section
LOCAL-STORAGE Section
SCREEN Section
REPORT Section
LINKAGE Section
Two program divisions, named identification division and Program ID, are mandatory for a COBOL
program.
https://www.javatpoint.com/cobol-tnterview-questions 9/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
35) What are the different divisions in the COBOL programming language?
Identification Division: The Identification division starts the COBOL program and is a
mandatory section in every COBOL program. The compiler and programmer use this division
to identify the program. We must have to define the PROGRAM-ID (a keyword) immediately
after the Identification division.
Environment Division: In the Environment division, we can define the input and output files
of the program. This division is optional and mainly used to describe the system's
environment in which the program will run.
Data Division: The data division contains information about the variables and data items
used in the program. It also defines the variable names, their lengths, decimal locations, and
the information about the storage formats.
Procedure Division: The procedure division is the most important section of the COBOL
program. It is like the main() function of C/C++ program. From this division, the program
starts the execution. The procedure division is the logical section of the program. Here all the
business logic is written. Like the C/C++ main() function, all COBOL programs must have a
procedure division. We can use the user-defined names and paragraphs in the procedure
division. It is mandatory to specify at least one statement in this division as it cannot be left
empty.
36) What is the difference between GOBACK, STOP RUN and EXIT
PROGRAM in COBOL programming?
Following is the list of key differences between GOBACK, STOP RUN, and EXIT PROGRAM in COBOL:
STOP RUN: This is used to stop the present work unit and return the control to OS.
EXIT PROGRAM: This is used to leave a program that another program has called.
In COBOL, comp is used to indicate binary usage. On the other hand, comp-3 is used to indicate a
packed decimal.
https://www.javatpoint.com/cobol-tnterview-questions 10/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
DELIMITED BY SPACE and DELIMITED BY SIZE is used along with the STRING for controlling the
information if it is replicated.
DELIMITED BY SIZE: In DELIMITED BY SIZE, the total size of information would be considered
the delimiter.
The Redefines clause allows the same storage allocation to be referenced by different data names.
To conduct REWRITE, we must open the record and read it from the file. So, the file must be opened
in I-O mode if you want to conduct a REWRITE function.
An IN-LINE PERFORM is a statement that allows the routine to be nested within the perform
statement itself instead of a separate paragraph.
It uses two statements, PERFORM and END-PERFORM, to block the COBOL statements between
them. IN-LINE PERFORM works as long as there are no internal GO TOs, not even to an exit.
A Pointer is used to specify the leftmost position within the receiving field where the first transferred
character will be stored.
https://www.javatpoint.com/cobol-tnterview-questions 11/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
The main difference between Global and External Variables is that the Global variables are accessible
only to the batch program. On the other hand, External variables can be referenced from any batch
program residing in the same system library.
In Binary search, the table element key values are In the case of Sequential search, the
arranged in ascending or descending order. The table table is searched from top to bottom. In
is 'halved' in this search technique to search for equal this search technique, the elements are
to, greater than or less than conditions until it finds not required to be in a specific sequence.
the element.
For more tables, the binary search is the best and Sequential search works well with lesser
much faster. tables.
For Binary search, SEARCH ALL is used. For sequential search, SEARCH is used.
Pic 9v99 is used to specify a three-position Numeric field. It contains an implied or assumed decimal
point after the first position. Here, v means an implied or assumed decimal point.
PIC 9.99 is a four-position field that contains a decimal point. On the other hand, the PIC 9v99 is
three-position numeric field which have an implied or assumed decimal point.
If it is INDEXED BY phrase
48) Which function is used to get the current date from the system with
century?
To get the current date from the system with century, we can use the intrinsic function called
FUNCTION CURRENT-DATE.
In the COBOL programming language, SSRANGE and NOSSRANGE are options for a compiler to
find the subscript out of range. NOSSRANGE is the default option where there will not be any run-
time error if the Index or subscript went out of a range.
There are a total of six sections in Data Division. Following is the list of them:
File Section
Screen Section
Report Section
Linkage Section
https://www.javatpoint.com/cobol-tnterview-questions 13/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
51) What is the difference between a Call and a Link in the COBOL
programming language?
A Call is an actual COBOL command used to initiate an external program and returns in the COBOL
programming language. On the other hand, a Link is the same as Call, but the only difference is that
it does not belong to a COBOL verb.
Comp is used for binary usage, while comp-3 is used to specify packed decimal.
53) In which condition we can perform the SORT operation? What are the
different rules of SORT operation?
https://www.javatpoint.com/cobol-tnterview-questions 14/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
AD
https://www.javatpoint.com/cobol-tnterview-questions 15/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
Preparation
Aptitude
https://www.javatpoint.com/cobol-tnterview-questions 16/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
Aptitude
Logical Verbal Ability Interview
Reasoning Questions
Verbal Ability
Reasoning Interview Questions
Company
Interview
Questions
Company Questions
Trending Technologies
B.Tech / MCA
https://www.javatpoint.com/cobol-tnterview-questions 17/18
4/9/23, 4:47 PM Top 50+ Most Asked COBOL Interview Questions and Answers (2023) - javatpoint
AD
https://www.javatpoint.com/cobol-tnterview-questions 18/18