Supported RPG Features

EVAL-CORR copies every subfield that exists in both data structures by the same name and a compatible data type. Subfields present only on the target are left untouched, and same-named subfields whose types are not compatible for plain EVAL (e.g. a character field versus a packed numeric field) are skipped silently. At least one operand must be a qualified data structure.

DCL-DS src QUALIFIED;
  Name   CHAR(10);
  Amount PACKED(7:2);
END-DS;
DCL-DS tgt QUALIFIED;
  Name   CHAR(10);
  Amount PACKED(7:2);
  Memo   CHAR(8) INZ('KEEPME');
END-DS;

src.Name   = 'Widget';
src.Amount = 12.34;

EVAL-CORR tgt = src;          // copies Name and Amount; leaves Memo as 'KEEPME'

The (H) extender (EVAL-CORR(H) tgt = src;) applies half-adjust rounding to numeric subfield assignments, matching EVAL(H). Width mismatches on character subfields pad with blanks (narrow → wide) or truncate from the right (wide → narrow); numeric precision / scale mismatches follow the default EVAL conversion rules (truncate the fractional part unless (H) is specified).

In fixed-format, EVAL-CORR is an extended-factor-2 operation: leave Factor 1 blank and write the whole assignment in the extended factor 2 area, exactly as you would for EVAL.

     C                   EVAL-CORR tgt = src

The (H), (M) and (R) extenders are available only in free-format - the fixed-format opcode field is not wide enough to hold EVAL-CORR and an extender, so fixed-format EVAL-CORR never half-adjusts.