Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Compiler and Runtime Migration Guide


SIZE ERROR on MULTIPLY and DIVIDE

The COBOL '74 and '85 Standards state that an intermediate result will be provided by the implementer when a COMPUTE, DIVIDE, or MULTIPLY statement has multiple receiving fields. For example: MULTIPLY A BY B GIVING C D should behave like:
MULTIPLY A BY B GIVING temp
MOVE temp TO C
MOVE temp TO D

where temp is an intermediate result provided by the implementer.

The Enterprise COBOL Programming Guide describes the use and definition of intermediate results. One such definition says that an intermediate result will have at most 30-digits (31-digits with ARITH(EXTEND)).

So, in the example above, if A, B, C, and D are all defined as PIC S9(18), A will be multiplied by B, yielding a 36-digit result, which will be moved to the 30-digit (or 31-digit) intermediate result, temp. Then temp will be moved to C and D.


Terms of use | Feedback

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