Rational Developer for System z
Enterprise PL/I for z/OS, Version 4.2, Compiler and Run-Time Migration Guide

Arithmetic built-in functions with scale factors and FIXED BIN

Under the RULES(IBM) compile-time option, which is the default, variables can be declared as FIXED BIN with a nonzero scale factor. Infix, prefix, and comparison operations are performed on scaled FIXED BIN using the same semantics as the old compilers.

However, the ADD, DIVIDE, or MULTIPLY built-in functions will not produce FIXED BIN results with nonzero scale factors.

The new compiler evaluates these built-in function as FIXED DEC rather than as FIXED BIN as the old compilers did if either of the following is true:

For example, the new compiler would evaluate the DIVIDE built-in function in the assignment statement below as a FIXED DEC expression:

       dcl (i,j) fixed bin(15);
       dcl x     fixed bin(15,2);

       ...

       x = divide(i,j,15,2);

Note that in this example, the result is FIXED DEC(6,1) instead of FIXED DEC(15,2). In the general case, for (p,q), the result is (t,s) where t = 1 + ceil(p/3.32) and s = ceil(q/3.32). To get a result that has the attributes FIXED DEC(p,q), apply the DECIMAL built-in function to all of the FIXED BIN arguments; so in this example, the expression would become DIVIDE( DEC(X), DEC(Y) 15, 2 ). You can also use the PRECTYPE compiler option to change the way the compiler interprets the precision, but that potentially changes the interpretation of other statements.

The compiler will flag this difference with message IBM1053.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)