DTRHELP.HLB  —  Commands Statements Clauses, REDEFINES Clause
       Provides an alternate way to define a field.

       Format

         level-no  field-name-1  REDEFINES  field-name-2

1  –  Arguments

    level-no

       Is the level number of field-name-1. Although not a part of the
       REDEFINES clause, the level number is shown in the format to
       clarify its position relative to the clause.

    field-name-1

       Is the name of the REDEFINES field. You use this name when you
       want to refer to this field. Although not a part of the REDEFINES
       clause, the field name is shown in the format to clarify its
       function and its position relative to the clause.

    field-name-2

       Is the name of the field being redefined.

2  –  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