Microsoft KB Archive/44234

Definition for the REDEFINES Clause in COBOL

PSS ID Number: Q44234 Article last modified on 04-20-1993

1.07 1.10 1.12 2.00 2.10 2.20 3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: The REDEFINES clause references the same storage area with different data description entries. It allows the programmer to specify more than one data type and description for the same area in memory. The following are some implementations of the REDEFINES clause; however, there are many other ways to REDEFINE variables than the ones shown below: WORKING-STORAGE SECTION. * This example allows you to view the alphabet * as one string or as individual characters. 01 ALPHABET PIC X(26) VALUE “ABCDEFGHIJKLMNOPQRSTUVWXYZ”. 01 LETTER-TABLE REDEFINES ALPHABET. 05 A-LETTER PIC X OCCURS 26 TIMES. * This example allows you to view a number as both * a character, in XCHAR, and the hexadecimal value * associated with that char, in NEWCHAR. 01 XCHAR PIC X. 01 NEWCHAR REDEFINES XCHAR PIC 9 COMP-X.

Additional reference words: 1.07 1.10 1.12 2.00 2.10 2.20 3.00 3.00a Copyright Microsoft Corporation 1993.