COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-51
REDEFINES Clause
•
Complete Description of Restrictions on Entry Order
The first redefinition of a data item must begin immediately after the last data
description entry associated with that item. Additional redefinitions can appear
immediately after the first one in any convenient order. Each redefinition begins
with the data description entry that contains the REDEFINES clause and continues
with any other entries needed to define the subordinate data items or condition-
names that complete it. That is, the scope of the redefinition continues until the
appearance of a level number less than or equal to that of the data-name being
redefined, or to the end of the current section of the Data Division; therefore, the
set of data description entries that describe a data item and its redefinitions must
appear in a continuous sequence within either a single record description or, if the
level number of the redefined item is 01 or 77, a single section of the Data Division.
•
Multiple Redefinitions
The REDEFINES clause associates the redefinition data item with the same
storage area occupied by the redefined data item. Because more than one
redefinition can make reference to the same redefined item, the same storage area
can be described in as many ways as required by the logic of the containing
source program.
Although the REDEFINES clause associates multiple data description entries with
one storage area, the data items described by these entries are independent in all
other respects; therefore, the actual content of the shared storage area at any
particular time does not necessarily represent a valid value for all of the associated
data items.
•
Alignment and the REDEFINES Clause
The location of data items within a record can be affected by their storage
alignment requirements (see SYNCHRONIZED Clause).
When a redefinition item is an elementary item, its first character position must
coincide with the first character position of the redefined item. The compiler issues
a diagnostic message if the item’s alignment requirements make this impossible.
When a redefinition item is a data structure, the first character position of its initial
contained elementary item must coincide with the first character position of the
redefined item. The compiler issues a diagnostic message if alignment
requirements of the elementary item make this impossible.