Wednesday 19 August 2015

REDEFINES Clause

REDEFINES is used to define the same memory area by different data items.

Rules:
  • Level numbers of data items REDEFINE should be same (See example below) .
  • REDEFINES cannot be used for level numbers 66 and 88.

Example:

01 WS-DATE1.                     
     05 WS-DD1  PIC X(02).
     05 WS-MM1  PIC X(02).
     05 WS-YYYY1  PIC X(04).
  01 WS-DATE2 REDEFINES WS-DATE1.
     05 WS-YYYY2  PIC X(04).
     05 WS-MM2  PIC X(02).
     05 WS-DD2  PIC X(02).

No comments:

Post a Comment