COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Example 44 REDEFINES Clause
WORKING-STORAGE SECTION.
01 RECORD-IN.
05 RECORD-CODE PIC 9.
05 RECORD-DETAIL PIC X(30).
05 RECORD-SUBTOTAL PIC 9(3)V99.
01 RECORD-TOTAL REDEFINES RECORD-IN.
05 TOTAL-1 PIC 9(5)V99.
05 TOTAL-2 PIC 9(5)V99.
05 TOTAL-3 PIC 9(5)V99.
05 TOTAL-4 PIC 9(5)V99.
05 TOTAL-5 PIC 9(6)V99.
Usage Considerations:
• Determining Size of Shared Storage Area
When the redefined item is a record item and one or more redefinitions specify a different
number of character positions than the redefined item (either greater or lesser), the size of the
shared storage area is determined by the requirements of the largest associated record item.
• Elementary items or Data Structures Can Be Redefined
You can describe an elementary data item and follow that description with a redefinition entry.
You can also describe a data structure and follow that description first with descriptions of its
component elementary items (with numerically higher level numbers), then with a redefinition
entry that redefines the data structure.
Redefinition continues until the appearance of a level number less than or equal to that of the
data-name being redefined (or the ending of the current section of the Data Division).
• Series of Redefinitions
You can describe a series of redefinition entries with the same level number as that of the
redefined entry, provided that each of these entries also contains a REDEFINES clause specifying
the data-name of the redefined item.
You cannot, however, separate a redefinition entry from the redefined entry by any data
description entry with a numerically lower level number.
• No Redefinitions of Level-66 or Level-88 Items
Data items of level 66 (RENAMES) and 88 (condition-name) cannot be redefined.
• Redefined Item Cannot Include OCCURS or REDEFINES
The description of data-name-2 cannot include an OCCURS clause or REDEFINES clause;
however data-name-2 can be subordinate to an item containing one or both clauses, and
items subordinate to data-name-2 can contain one or both clauses. Because an OCCURS
clause can occur in the description of data-name-1, it is common to declare a record first
and then to declare an array that redefines the same storage.
Neither the original definition nor the redefinition can include an item whose size is variable
due to an OCCURS clause of a subordinate entry.
• No Subscripting or Qualifying in REDEFINES
The REDEFINES declaration cannot include any subscripting or qualification on data-name-2.
Qualification is automatic.
• VALUE Clauses Only in Condition-Name Descriptions
VALUE clauses are not permitted in the redefinition except as part of a condition-name declared
in conjunction with a conditional variable in the redefinition.
188 Data Division










