COBOL 66 Level and Redefines The Real Benefits

COBOL 66 Level

The 66 level assigns an alternate name to a field or group. It doesn’t add a new field to the record, it just assigns an alternate name to an existing field. Click here to read more on COBOL LEVEL numbers.

You must use the level number 66 for data description entries that contain the RENAMES clause. A level-66 entry cannot rename another level-66 entry, nor can it rename a level-01, level-77, or level-88 entry.

->->--66 data-name-1 RENAMES data-name-2--*----------------*---><-
                                  *--THROUGH--*--data-name-3--*
                                  *--THRU-----*

So, the key point is it does not take any extra space. it is just like logical re-naming. This renaming does not take additional space. And, your copy book layout also does not increase.

Advertisements

COBOL REDEFINES

Mainframe languages, especially COBOL, often reuse, or “redefine” an area in a record to save space.

       01  SUBSCRIBERS.
           05  TYPE-OF-NAME                            PIC X.
           05  INDIVIDUAL-NAME.
               10  LAST-NAME                           PIC X(12).
               10  FIRST-NAME                          PIC X(8).
           05  COMPANY-NAME REDEFINES INDIVIDUAL-NAME  PIC X(20).
           05  ADDRESS                                 PIC X(20)
           05  CITY                                    PIC X(15)
           05  STATE                                   PIC X(2)
           05  ZIP                                     PIC X(5)

By redefining, you can save space. Then the question is how it differs from Level -66. Yes, Redefines save space.

Suppose, in a COPY book, you want to use four 01 level of each 1000 bytes. Then, you need to declare ‘1000’ bytes 4 times. This you can use redefines to avoid multiple time declaration. So, you are saving space here.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.