Supported RPG Features

The FLTDIV keyword on CTL-OPT (or H-spec) controls how division is performed when both operands are integer types (INT or UNS).

Value Behavior
*NO (default) Division uses packed-decimal intermediate arithmetic (packed-decimal precision rules)
*YES Both operands are promoted to FLOAT(8) before dividing; the intermediate result is a floating-point value

For most programs the observable output is identical either way, because packed-decimal arithmetic already preserves fractional parts. The difference matters when integer values are large enough to exceed packed-decimal precision (63 digits) or when IEEE 754 double rounding is preferred.

CTL-OPT FLTDIV(*YES);
DCL-S A INT(10) INZ(7);
DCL-S B INT(10) INZ(2);
DCL-S Result PACKED(9:4);
Result = A / B;   // intermediate computed as 7.0 / 2.0 = 3.5
DSPLY %CHAR(Result);  // → 3.5000