66 Level Number - Renaming Entire Group
66 Level Number - Renaming Entire Group Example
Scenario - Renaming the entire source variable.
Code -
----+----1----+----2----+----3----+----4----+----5----+
IDENTIFICATION DIVISION.
PROGRAM-ID. RENAMEEG.
AUTHOR. MTH.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VAR1.
02 WS-GRP-ITEM1.
05 WS-VAR11 PIC X(10) VALUE "MAINFRAMES".
05 FILLER PIC X(01).
05 WS-VAR12 PIC X(03) VALUE "ARE".
05 FILLER PIC X(01).
05 WS-VAR13 PIC X(10) VALUE "LEGENDARY".
05 FILLER PIC X(01).
05 WS-VAR14 PIC X(10) VALUE "SYSTEMS".
* Renaming WS-GRP-ITEM3
66 WS-GRP-ITEM2 RENAMES WS-GRP-ITEM1.
PROCEDURE DIVISION.
DISPLAY "Group Item1: " WS-GRP-ITEM1.
DISPLAY "Group Item2: " WS-GRP-ITEM2.
STOP RUN.
Output -
Group Item1: MAINFRAMES ARE LEGENDARY SYSTEMS Group Item2: MAINFRAMES ARE LEGENDARY SYSTEMS
Explaining Example -
In the above example:
- WS-GRP-ITEM1 is a group item with multiple elementary variables. WS-GRP-ITEM2 is renaming the entire group (WS-GRP-ITEM1). So, WS-GRP-ITEM2 points the data in WS-GRP-ITEM1 and displays the same.