Dynamic Redefine fields

Configuring an asset with dynamic redefine with an indicator field

What is a Dynamic REDEFINE?

In COBOL, if a program includes an indicator field, users can configure a dynamic REDEFINES field. This approach allows you to specify runtime conditions to determine which REDEFINE option should be used for serialization.

Example

01 EMPLOYEE-RECORD.
   05 DATA-TYPE-IND PIC X(01). 
* Values:'R' for RAW ,  'N' for Name, 'D' for Details
   05 EMPLOYEE-RAW PIC X(50).
   05 EMPLOYEE-NAME REDEFINES EMPLOYEE-RAW.
      10 FIRST-NAME  PIC X(20).
      10 LAST-NAME   PIC X(30).
   05 EMPLOYEE-DETAILS REDEFINES EMPLOYEE-RAW.
      10 EMP-ID      PIC X(10).
      10 EMP-DEPT    PIC X(10).
      10 EMP-SALARY  PIC X(30).

At runtime, the value in the DATA-TYPE-IND field determines which of the three REDEFINES options to use:

  • 'R' for EMPLOYEE-RAW
  • 'N' for EMPLOYEE-NAME
  • 'D' for EMPLOYEE-DETAILS

By specifying these conditions on the Module Asset, you can dynamically handle REDEFINE fields, avoiding the need to commit to a fixed structure like with Asset Variants.


Configuring a Dynamic REDEFINE Field

Steps

  1. Open Configuration
    Click the configuration button on the REDEFINE field.

  2. View REDEFINE Options
    In the modal dialog, review the available REDEFINE options.

    • Set Evaluation Order: Arrange options by likelihood to improve performance. More likely options should be evaluated first.
    • Set a Default Option: Choose a fallback option to be used if no conditions match.
  3. Configure Runtime Conditions
    Select one of the REDEFINE options and click "Continue" to set the runtime conditions required for the field to be serialized by this option.
    REDEFINE Option Modal

  4. Set Runtime Conditions
    Define the conditions that determine which REDEFINE option to use:

    • Indicator Field Before the REDEFINE Field
      If the indicator field appears before the REDEFINE field, click the plus (+) icon to select the field and specify the operator and expected value.

      • Example: To serialize using EMPLOYEE-DETAILS, set the condition to check for the value 'D' in the DATA-TYPE-IND field.
    • Indicator Field Inside or After the REDEFINE Field
      If the indicator field appears inside or after the REDEFINE field, specify the offset and expected value in HEX.

      • Click "Add Identifier by Offset".

      • Specify the position offset (relative to the REDEFINE field start) and the expected HEX value.

      • Example: To verify that the EMP-ID field equals 12345, set the offset to 0 (zero-based) and the HEX value to F1F2F3F4F5.