ILE COBOL Language Reference
The compiler uses algorithms to determine the number of integer and decimal
places reserved for intermediate results.
In the following discussion of how the compiler determines the number of
integer and decimal places reserved for intermediate results, these
abbreviations are used:
- i
- The number of integer places carried for an intermediate result.
- d
- The number of decimal places carried for an intermediate result.
- ROUNDED
- If the ROUNDED option is used, one more integer or decimal place might be
added for accuracy, if necessary. Only the final results are
rounded; the intermediate results are not rounded. 62 digits is
the maximum number of digits that can be accurately rounded.
- dmax
- In a particular statement, the largest of:
- The number of decimal places needed for the final result field(s).
- The maximum number of decimal places defined for any operand, except
divisors or exponents.
- The outer-dmax for any function operand.
- inner-dmax
- The inner-dmax for a function is the largest of:
- The number of decimal places defined for any of its elementary
arguments.
- The dmax for any of its arithmetic expression arguments.
- The outer-dmax for any of its embedded functions.
- outer-dmax
- The number that determines how a function result contributes to operations
outside of its own evaluation (for example if the function is an operand in an
arithmetic expression or an argument to another function).
- op1
- The first operand in a generated arithmetic statement. For
division, op1 is the divisor.
- op2
- The second operand in a generated arithmetic statement. For
division, op2 is the dividend.
- i1,i2
- The number of integer places in op1 and op2, respectively.
- d1,d2
- The number of decimal places defined for op1 and op2, respectively.
- ir
- Intermediate result field obtained from the processing of a generated
arithmetic statement or operation. Intermediate results are represented
by ir1, ir2, and so on. Successive intermediate results may share the
same memory location.
Below we use a COMPUTE statement to demonstrate the use of intermediate
results in an arithmetic expression. In this case, the following
statement:
COMPUTE Y = A + B * C - D / E + F ** G
is replaced by
| F ** G
|
| yielding ir1
|
| MULTIPLY B
| BY C
| yielding ir2
|
| DIVIDE E
| INTO D
| yielding ir3
|
| ADD A
| TO ir2
| yielding ir4
|
| SUBTRACT ir3
| FROM ir4
| yielding ir5
|
| ADD ir5
| TO ir1
| yielding Y
|
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.