SIZE ERROR on MULTIPLY and DIVIDE

SIZE ERROR behaves differently depending on whether CMPR2 or NOCMPR2 is in effect.

The 74 COBOL Standard and the 85 COBOL Standard 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 for z/OS® 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 aforementioned example, 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.