Size of Operands

The maximum size of each operand is 18 decimal digits.

IBM Extension

The maximum size of a zoned decimal or an internal decimal operand is 63 decimal digits.

End of IBM Extension

From each operand, you can determine the number of decimal digits in the composite of operands. The composite of operands is a hypothetical data item resulting from aligning the operands at the decimal point and then superimposing them on one another.

For example, assume that each item is defined as follows in the Data Division:
A  PICTURE 9(7)V9(5).
B  PICTURE 9(11)V99.
C  PICTURE 9(12)V9(3).
If the following statement is executed, the composite of operands consists of 17 decimal digits:
ADD A B TO C
It has the following implicit description:
Composite-of-Operands PICTURE 9(12)V9(5).

If the composite of operands is 18 digits or less, enough places are carried so that no significant digits are lost during execution.

IBM Extension

When the (default) compiler option *NOEXTEND or the PROCESS statement option NOEXTEND is specified, the composite of operands can have a maximum length of 30 decimal digits.

The composite of operands can have a maximum length of 31 decimal digits when the arithmetic mode compiler option *EXTEND31 or PROCESS statement option EXTEND31 is specified.

Start of change The composite of operands can have a maximum length of 34 decimal digits when the arithmetic mode compiler option *EXTEND31FULL or PROCESS statement option EXTEND31FULL is specified. End of change

The composite of operands can have a maximum length of 63 decimal digits when the arithmetic mode compiler option *EXTEND63 or PROCESS statement option EXTEND63 is specified.

Note: If the composite of operands exceeds the specified maximum, significant digits may be lost during execution.
End of IBM Extension

The following table shows the maximum number of decimal digits that are allowed for the composite of operands in arithmetic statements.

Compiler Option/Process Statement Maximum Length of Composite (decimal digits)
*NOEXTEND/NOEXTEND

18

IBM Extension

30

End of IBM Extension
*EXTEND31/EXTEND31

18

IBM Extension

31

End of IBM Extension
Start of change *EXTEND31FULL/EXTEND31FULL End of change
IBM Extension

34

End of IBM Extension
*EXTEND63/EXTEND63
IBM Extension

63

End of IBM Extension

The following list shows how the composite of operands is determined for arithmetic statements:

Statement
Determination of the Composite of Operands
ADD
Superimposing all operands in a given statement (except those following the word GIVING)
COMPUTE
Restriction does not apply
DIVIDE
Superimposing all receiving data items, except the REMAINDER data item
MULTIPLY
Superimposing all receiving data items
SUBTRACT
Superimposing all operands in a given statement (except those following the word GIVING)

In all arithmetic statements, it is important to define data with enough digits and decimal places to ensure the desired accuracy in the final result. For more information on arithmetic precision, see Appendix B. Intermediate Results and Arithmetic Precision.