Always enabled.
Undefined unless no FIXEDOVERFLOW ON unit is present, in which case it is raised to ERROR.
When the result exceeds the maximum allowed by the computer/implementation. This is controlled by the -fdmaxp compiler option.
FIXEDOVERFLOW is also raised for built-in functions where the intermediate result of the specified P,Q arguments exceeds the user-specified P,Q.
Behavior according to the IBM LRM | Actual IBM behavior | Enterprise Developer behavior |
---|---|---|
The MAXVAL() and PRECVAL() built-in functions for a FIXED DECIMAL variable (or expression) reflect the true state of a variable with an even precision. | The MAXVAL() and PRECVAL() built-in functions for a FIXED DECIMAL variable (or expression) do not reflect the true state of a variable with an even precision. For example, if you were to declare a FIXED DECIMAL(4,0) variable and assign it the value from a FIXED BIN(31) that contains a value between 10000 and 99999, the variable when referenced does have your assigned value; however, MAXVAL returns 9999, and PRECVAL returns 4. | Matches the actual IBM behavior. |
The MULTIPLY built-in function, generates two FIXEDOVERFLOW conditions - one for the MULTIPLY, and one for the assignment (FOFLONASGN). See Example 1 below. | The MULTIPLY built-in function, generates just one FIXEDOVERFLOW condition. | Matches the IBM LRM. |
A native add of two FIXED DECIMAL variables with equal P,Q values generates FIXEDOVERFLOW when run under z/OS. See Example 2 below. | A native add of two FIXED DECIMAL variables with equal P,Q values does not generate FIXEDOVERVLOW when run under z/OS. | Matches the IBM LRM. |
The BINARY built-in function raises FIXEDOVERFLOW when the first argument is an expression intended to raise it. See Example 3 below. | The BINARY built-in function does not raise FIXEDOVERFLOW when the first argument is an expression intended to raise it unless you omit the P,Q arguments. | Matches the IBM LRM. |
Raises FIXEDOVERFLOW for the FIXED built-in function when the expression argument is intended to raise it. See Example 4 below. | Does not raise FIXEDOVERFLOW for the FIXED built-in function when the expression argument is intended to raise it. | Matches the IBM LRM. |
Raises FIXEDOVERFLOW for the FIXEDBIN built-in function when the expression argument is intended to raise it. See Example 5 below. | Does not raise FIXEDOVERFLOW for the FIXEDBIN built-in function when the expression argument is intended to raise it, and gives an incorrect result. | Does not raise FIXEDOVERFLOW in this scenario, but gives a correct result. |
Raises FIXEDOVERFLOW for the PRECISION built-in function when the expression argument is intended to raise it. See Example 6 below. | Does not FIXEDOVERFLOW for the PRECISION built-in function when the expression argument is intended to raise it. | Matches the IBM LRM. |
For the conversion of a FIXED DECIMAL(4,0) variable to a FIXED BIN(31) on assignment, the maximum value is equivalent to a FIXED BIN(14). See IBM 5.3 LRM, page 76, table 35. | For the conversion of a FIXED DECIMAL(4,0) variable to a FIXED BIN(31) on assignment, the maximum value is actually equivalent to a FIXED BIN(31). | Matches the actual IBM behavior. |
The following examples illustrate the scenarios described in the IBM discrepancies between defined and actual FIXEDOVERFLOW behavior section above:
DCL DEC1 DEC FIXED(5,2) init(999); DCL DEC2 DEC FIXED(5,2) init(112); DCL DEC3 DEC FIXED(5,2); /* 111888 - result overflows 7,2 giving 11888 */ /* 11888 - intermediate result overflows 5,2 on assignment */ /* IBM only generates 1 FIXEDOVERFLOW contradicting what */ /* LRM and Programming guide state for FOFLONASGN and FOFLONMULT */ DEC3 = MULTIPLY(DEC1, DEC2, 7, 2);
DCL DEC1 DEC FIXED(4,2); DCL DEC2 DEC FIXED(4,2); DCL DEC3 DEC FIXED(7,2); dcl TOOBIG DEC FIXED(5,2) init(999); DEC1 = 1; DEC2 = TOOBIG; /* shouldn't be possible - demonstrates IBM behavior */ put skip data(dec2); put skip list('hex(dec2): ' || hex(dec2)); dec3 = DEC1 + DEC2; /* We generate FIXEDOVERFLOW - IBM DOES NOT */ put skip list('hex(dec3): ' || hex(dec3));
DCL DEC1 DEC FIXED(5,2) init(1); DCL DEC2 DEC FIXED(5,2) init(999); DCL BIN1 FIXED BIN(31); BIN1 = BINARY(DEC1 + DEC2, 3, 0); /* IBM does not generate FIXEDOVERFLOW */
DCL DEC1 DEC FIXED(7,2); DCL BIN1 FIXED BIN(31) init(998); DEC1 = FIXED(BIN1 + 2.5, 5, 2);
DCL DEC1 DEC FIXED(7,2) init(998.5); DCL BIN1 FIXED BIN(31); BIN1 = FIXEDBIN(DEC1 + 2.5, 3, 0);
DCL DEC1 DEC FIXED(7,2); DCL BIN1 FIXED BIN(31) init(998); DEC1 = PRECISION(BIN1 + 2.5, 5, 2);