DTRHELP.HLB  —  Commands Statements Clauses, REDEFINES Clause, Example
       The following record definition shows a redefinition of the field
       PART_NUMBER. PART_NUMBER is a numeric field containing 10 digits.
       Two group fields redefine PART_NUMBER: PART_NUMBERS_PARTS and
       PART_NUMBER_GROUPS. Each redefinition specifies a group field
       containing a total of 10 digits (the total number of digits in
       all subordinate fields):

       05 PART_NUMBER PIC 9(10)
       05 PART_NUMBER_PARTS REDEFINES PART_NUMBER.
          07 PRODUCT_GROUP PIC 99.
          07 PRODUCT_YEAR PIC 99.
          07 ASSEMBLY_CODE PIC 9.
          07 SUB_ASSEMBLY PIC 99.
          07 PART_DETAIL PIC 999.
       05 PART_NUMBER_GROUPS REDEFINES PART_NUMBER.
          07 PRODUCT_GROUP_ID PIC 9(4).
          07 PART_DETAIL_ID PIC 9(6).

       In this example, the field PRODUCT_GROUP refers to the lowest-
       valued digits of PART_NUMBER; PRODUCT_YEAR refers to the next two
       lowest-valued digits, and so on.
Close Help