Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
SCREEN COBOL Source Program
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
2-16
Evaluation of Expressions
is equivalent to:
ADD a, b, c GIVING temp
ADD temp TO c
ADD temp TO d(c)
ADD temp TO e
where temp is the temporary storage location.
Intermediate Results
Intermediate results are maintained by SCREEN COBOL during the evaluation of
arithmetic expressions. The maximum number of digits held for an intermediate result
is 18. If this limit is exceeded, arithmetic overflow occurs. Table 2-8 uses the following
abbreviations to explain intermediate operations:
•
IR—the number of integer places carried for an intermediate result
•
DR—the number of decimal places carried for an intermediate result
•
OP1—the first operand in an arithmetic expression, which has the form
9(I1)V9(D1), where:
°
I1 is the number of integer places carried.
°
D1 is the number of decimal places carried for the first operand.
•
OP2—the second operand in an arithmetic expression, which has the form
9(I2)V9(D2), where:
°
I2 is the number of integer places carried.
°
D2 is the number of decimal places carried for the second operand.
•
OPR—the desired result, which has the form 9(IR)V9(DR), where IR is the number
of places carried for the integer result and DR is the number of places carried for the
decimal result
Table 2-8. Digits Held for Intermediate Results
Operation Decimal Places
OP1 + OP2 DR is the greater of D1 or D2.IR is the lesser of (the greater of I1 or I2) or
18-DR.
OP1 - OP2 DR is the greater of D1 or D2.IR is the lesser of (the greater of I1 or I2) or
18-DR.
OP1 * OP2 DR is the sum (D1 + D2).IR is the lesser of (I1+I2) or 18-DR.
OP1 / OP2 DR is the greater of D1 or 1.IR is the lesser of (I1+D2) or 18-DR
OP1 **
OP2
OP2 is restricted to integer values.OP2's value is any literal or a data item.(For
example: DR is D1; IR is 18-DR.)
Note. If (I1+D2+DR) is greater than 18, the low-order digits of the quotient are lost; in other
words,any part of the quotient less than the following number is lost: 10 ** (I1+D2+DR-18)