Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 5: Data Division


RENAMES clause (Level 66)

  • It is used to regroup the elementary data items of same or different groups and assign them a new name. This way a new group can be formed keeping the original groups intact.
  • In other words, it used to form a logical group from the elementary data items of different or same group.
  • For example,

    01 EMPL-DEPT-RECORD. 05 EMP-DETAILS. 10 EMP-NAME PIC X(15). 10 EMP-SALARY PIC 9(06). 05 DEPT-DETAILS. 10 DPET-NAME PIC X(10). 10 DPET-MANAGER PIC X(15). 10 DEPT-LOCATION PIC X(10). 66 EMP-DEPT-INFO RENAMES EMP-NAME THRU DEPT-NAME.

  • In above example, EMP-DEPT-INFO will become a new group consisting of EMP-NAME, EMP-SALARY, DEPT-NAME. Note that the new group overlaps the two original groups, namely whole EMP-DETAILS and part of DEPT-DETAILS. Such overlapping is permitted provided the elementary items are all contiguous.
  • Basic syntax of the RENAMES clause:-

    66 data-name-1 RENAMES data-name-2 [{THRU|THROUGH} data-name-3]

  • Important rules to be considered while using RENAMES clause:-
    • It must be declared at special level number 66.
    • The level number must begin in Margin A or any position after it. data-name-1 must begin from Margin B or any position after it.
    • RENAMES clause must be coded at the end of group
    • Entries to be grouped and renamed can be elementary data items or group data items. They, however, cannot be items of level 01, 77, 88 or another 66 entry.
    • Entries to be grouped and renamed must be in a sequential order
    • data-name-1 cannot be used as a qualifier (in OF clause).
    • The entries (and the entries from which they have subordinated) having OCCURS clause cannot be renamed






© copyright mainframebug.com
Privacy Policy