Many mainframe programmers not so clear about COBOL data division clauses. The below clauses extensively used in COBOL programmes. Also, the below are top COBOL interview questions.
The Data Division clauses are used to describe elementary and group data items. An elementary data item is a data item that is not further divided. COBOL provides many clauses to describe the characteristics of an elementary data item.
Group items cannot have PICTURE, SYNCHRONIZED, JUSTIFIED, or BLANK WHEN ZERO clauses.
The REDEFINES clause lets you describe the same computer memory using different data descriptions. This clause can be used with both elementary and group data items.
data-name-1 REDEFINES data-name-2
The data-name-2 item must be a previously defined data item and must have the same level number as data-name-1. In addition, no entries with a lower-level number can occur between data-name-2 and data-name-1. In other words, data-name-1 must immediately follow the definition of data-name-2, except that multiple redefinitions of the same area are permitted. When you use multiple REDEFINES clauses, all the clauses must refer back to the original data-name that defined the area.
The PICTURE clause (together with the USAGE clause) defines the exact size, format, and type of data for an elementary item. Every elementary item, with a few exceptions, must have a PICTURE (or the abbreviation PIC) clause
03 FILLER PIC XXX
The USAGE clause lets you specify the format of a data item in the computer’s memory to make most efficient usage of the computer’s memory space and arithmetic capabilities. The USAGE clause does not affect the use of an item (although some statements in the Procedure Division restrict some operands to certain USAGE clauses).
This clause can be used with both elementary and group data items.
USAGE IS :
- Packed decimal