Redefinition

The redefinition option is used with DEFINE DATA LOCAL, DEFINE DATA PARAMETER, DEFINE DATA INDEPENDENT, DEFINE DATA CONTEXT and DEFINE DATA OBJECT.

The redefinition option has the following syntax:

REDEFINE field-name

level

rgroup

../graphics/dot3.gif
rfield (format-length [/array-definition])
FILLER nX

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.


Function

A redefinition may be used to redefine a group, a view, a DDM field or a single field/variable (that is a scalar or an array).

Notes:

  1. A redefinition of a view or a DDM field is not applicable to a parameter-data-definition.
  2. Unicode fields should not be redefined as alphanumeric (A) or numeric (N) fields.

See also Redefining Fields in the Programming Guide.

Restrictions

  • Handles, X-arrays and dynamic variables cannot be redefined and cannot be contained in a redefinition clause.

  • A group that contains a handle, X-array or a dynamic variable can only be redefined up to - but not including or beyond - the element in question.

Syntax Description

Syntax Element Description
field-name
Name of Field to be Redefined:

The name of the group, view, DDM field or single field that is being redefined.

level
Level Number of Field being Redefined:

Level number is a 1- or 2-digit number in the range from 01 to 99 (the leading zero is optional) used in conjunction with field grouping. Fields assigned a level number of 02 or greater are considered to be a part of the immediately preceding group, which has been assigned a lower level number.

rgroup
Name of Resulting Group:

The name of the group resulting from the redefinition.

Note:
In a redefinition within a view-definition, the name of rgroup must be different from any field name in the underlying DDM.

rfield
Name of Resulting Field:

The name of the field resulting from the redefinition.

Note:
In a redefinition within a view-definition, the name of rfield must be different from any field name in the underlying DDM.

format-length
Format/Length of Resulting Field:

The format and length of the resulting field (rfield).

array-definition
Array Dimension Definition:

With an array-definition, you define the lower and upper bounds of dimensions in an array-definition.

For further information, see Array Dimension Definition.

FILLER nX
Filler Byte Definition:

With this notation, you define n filler bytes - that is, segments which are not to be used - in the field that is being redefined.

The definition of trailing filler bytes is optional.

Examples of REDEFINE Usage

Example 1:
   DEFINE DATA LOCAL
     01 #VAR1 (A15)
     01 #VAR2
        02 #VAR2A (N4.1) INIT <0>
        02 #VAR2B (P6.2) INIT <0>
     01 REDEFINE #VAR2
        02 #VAR2RD (A10)
   END-DEFINE
   ...
Example 2:
   DEFINE DATA LOCAL
   01 MYVIEW VIEW OF STAFF
      02 NAME
      02 BIRTH
      02 REDEFINE BIRTH
         03 BIRTH-YEAR  (N4)    
         03 BIRTH-MONTH (N2)
         03 BIRTH-DAY   (N2)
   END-DEFINE
   ...
Example 3:
   DEFINE DATA LOCAL           
   1 #FIELD (A12)
   1 REDEFINE #FIELD
     2 #RFIELD1 (A2)
     2 FILLER 2X
     2 #RFIELD2 (A2)
     2 FILLER 4X
     2 #RFIELD3 (A2)
   END-DEFINE
   ...