Sunday, September 8, 2019

RENAME in COBOL

COBOL Renames clause is used to regroup the elementary data items and gives them an alternative name. This is a logical grouping of the elementary data items which are defined in a sequential order.It is useful for renaming by overlapping elementary elements.66 Level number is used for defining it

       IDENTIFICATION DIVISION.
       PROGRAM-ID. RENAME.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 GRP1.
        05 WS-A PIC X(3) VALUE 'IBM'.
        05 GRP2.
          07 WS-B PIC X(10) VALUE 'MAINFRAME'.
       66 WS-R RENAMES WS-A THRU WS-B.
       PROCEDURE DIVISION.
           DISPLAY WS-R
           STOP RUN.

No comments:

Post a Comment