COBOL 66 Level Useful Example

Recently in an interview asked a question about Level 66. This is a simple question but rarely used in real-time.


So, 66 Level will be used to rename a group of elements. Let me show an example,

A level-number of 66 is used to declare a re-grouping of previously defined items, irrespective of how those items are structured.

       01  customer-record.
           05  cust-key            PIC X(10).
           05  cust-name.
               10  cust-first-name PIC X(30).
               10  cust-last-name  PIC X(30).
           05  cust-dob            PIC 9(8).
           05  cust-balance        PIC 9(7)V99.
 
       66  cust-personal-details   RENAMES cust-name THRU cust-dob.
       66  cust-all-details        RENAMES cust-name THRU cust-balance.

The “cust-personal-details” is a new group name to the customer-record. So the new group name will NOT take additional space, it uses the original group namespace.

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.