COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-50
REDEFINES Clause
•
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.
•
Restrictions on Level Numbers
The level number of a data description entry with a REDEFINES clause can be 01
in the Working-Storage Section, Extended-Storage Section, or Linkage Section but
not in the File Section (where consecutive level-01 items are always multiple
definitions of the same storage space). When the level number is other than 01,
the redefinition must specify a number of character positions (bytes) that is less
than or equal to the number of character positions in the data item being redefined.
•
Redefinitions Must All Specify Same Redefined Item
The REDEFINES clause redefines a storage area, not the data items occupying
the area. Multiple redefinition of the same record area is permitted, but each
instance of data-name-2 must designate the name of the entry that originally
defined the area.
•
The EXTERNAL Clause and the REDEFINES Clause
The redefinition entry cannot contain the EXTERNAL clause.
When the redefined item is an external record item or is described with a level
number other than 01, the redefinition can specify the same or fewer character
positions (bytes) than the redefined item, but cannot specify more. When the
redefined item is a record (that is, has a level number of 01) without the
EXTERNAL clause, there is no such constraint.