Function
The MULTIPLY statement is used to perform multiplication of two numeric operands and store the result.
Format 1 | of the MULTIPLY statement stores the products in the specified multiplier. |
Format 2 | of the MULTIPLY statement uses the GIVING phrase. |
Format 1
MULTIPLY {identifier-1 | literal-1} BY {identifier-2 [ROUNDED]}...
[ON SIZE ERROR imperative-statement-1]
[NOT ON SIZE ERROR imperative-statement-2]
[END-MULTIPLY]
Syntax rules
Each identifier must refer to a numeric elementary item.
The value of identifier-1 or literal-1 is multiplied by the value of identifier-2. The multiplication product replaces the current value of identifier-2.
The maximum size of the product is 31 decimal digits.
Additional rules are given under "Phrases in statements" et seq., where the ROUNDED, (NOT) ON SIZE ERROR, and GIVING phrases are discussed.
Example 8-57
Statement | PICTURE of result item | Calculation |
|
|
|
Format 2
MULTIPLY {identifier-1 | literal-1} BY {identifier-2 | literal-2}
GIVING {identifier-3 [ROUNDED]}...
[ON SIZE ERROR imperative-statement-1]
[NOT ON SIZE ERROR imperative-statement-2]
[END-MULTIPLY]
Syntax rules
Each identifier preceding the word GIVING must refer to a numeric elementary item.
identifier-3... may refer to a numeric elementary item or a numeric edited elementary item.
The value of identifier-1 or literal-1 is multiplied by the value of identifier-2 or literal-2, and the product is stored in identifier-3 (the same applies to additional receiving items).
The maximum size of the product is 31 decimal digits.
Additional rules are given under "Phrases in statements" et seq., where the ROUNDED, (NOT) ON SIZE ERROR, and GIVING phrases are discussed.
Example 8-58
Statement | PICTURE of result item (C) | Calculation |
|
|
|