The DECIMAL option specifies how the compiler should handle certain FIXED DECIMAL operations and assignments.
.-,--------------------. V .-FOFLONASGN---. | >>-DECIMAL--(----+-+-NOFOFLONASGN-+-+-+--)--------------------->< | .-NOFOFLONMULT-. | +-+-FOFLONMULT---+-+ | .-NOFORCEDSIGN-. | +-+-FORCEDSIGN---+-+ | .-NOTRUNCFLOAT-. | '-+-TRUNCFLOAT---+-'
Conversely, under the NOFOFLONASGN option, the compiler will generate code that will not raise the FIXEDOVERFLOW condition when significant digits are lost in such an assignment.
For example, given a variable A declared as FIXED DEC(5), the assignment A = A + 1 might raise FOFL under the FOFLONASGN option, but will never raise FOFL under the NOFOFLONASGN option.
Note, however, that under the NOFOFLONASGN option, the FIXEDOVERFLOW condition can still be raised by operations that produce a result with more digits than allowed by the FIXEDDEC suboption of the LIMITS option. For example, given a variable B declared as FIXED DEC(15) with the value 999_999_999_999_999 and given that the FIXEDDEC suboption of the LIMITS specifies the maximum precision as 15, then the assignment B = B + 1 will raise the FIXEDOVERFLOW condition (if FOFL is enabled).
Conversely, under the NOFOFLONMULT option, the compiler will generate code that will produce a truncated result for any such use of the MULTIPLY built-in function.
Note that the use of the FOFLONMULT option changes the default language semantics (which is to truncate a too large result of the MULTIPLY built-in function applied to FIXED DEC - unless the SIZE condition is enabled).
Also, when this option is in effect, more data exceptions might occur when you run your code. For example, if you assign one FIXED DEC(5) variable to another FIXED DEC(5) variable, the compiler would normally generate an MVC instruction to perform the move. However, if the FORCEDSIGN option is in effect, to ensure that the result has the preferred sign, the compiler will generate a ZAP instruction to perform the move. If the source contains invalid packed decimal data, the ZAP instruction, but not the MVC instruction, will raise a decimal data exception.
Under this option, data exceptions might also be raised when one PICTURE variable is assigned to another PICTURE variable because that conversion usually involves an implicit conversion to FIXED DEC, which, under this option, will generate a ZAP instruction that will raise a data exception if the source contains invalid data.
Under DECIMAL(NOFORCEDSIGN), a "negative zero" might be produced by certain calculations. However, a programmer should rely on getting a negative zero only when assigning a negative literal to a FIXED DEC that cannot hold a value of that small a magnitude (such as assigning -.001 to a FIXED DEC(5,2)).
Under TRUNCFLOAT, if a hexadecimal float value is converted to FIXED DEC(p,q) where p <=18 and abs(q) <= p, and if the source value is too large for the target, the source value will be truncated and overflow will not be raised.
The default is NOTRUNCFLOAT.