Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)

Data Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
5-14
RENAMES Clause
When the level number is not 01, the redefinition should be the same as the
number of character positions (bytes) in the data item you are redefining..
The redefined item can be subordinate to an item with an OCCURS clause or a
REDEFINES clause.
The REDEFINES entry can be followed by subordinate data entries. Redefinition
continues until the appearance of a level number less than or equal to that of the
data name being redefined or until the ending of the current section of the Data
Division.
You can use a REDEFINES clause to redefine a PIC N field, which allows only
double-byte data, as an alphanumeric PIC X field. Doing so makes it possible to
move double-byte data items to alphanumeric data items. For example:
WORKING-STORAGE SECTION.
:
01 WS-KANJI-ONLY-FIELD PIC N(10)
01 WS-KANJI-TO-PIC-X-REDEF REDEFINES WS-KANJI-ONLY
FIELD PIC X(20)
The REDEFINES clause redefines a storage area, not the data items occupying the
area. Multiple redefinition of the same area is permitted, but all definitions must begin
with a REDEFINES clause containing the data name of the entry that originally defined
the area.
The following example illustrates the 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.
05 total-5-sub REDEFINES total-5 PIC X(8).
RENAMES Clause
The RENAMES clause assigns a new data name to one or more contiguous
elementary items within a data description. RENAMES does not cause any allocation
of storage. The clause can only be used with a level 66 entry.
66
new-name
RENAMES
old-name
[ { THROUGH }
end-name
] .
[ { THRU } ]