The MULTIPLY statement multiplies numeric items and sets the values of data items equal to the results.
In format 1, the value of identifier-1 or literal-1 is multiplied by the value of identifier-2; the product is then placed in identifier-2. For each successive occurrence of identifier-2, the multiplication takes place in the left-to-right order in which identifier-2 is specified.
In format 2, the value of identifier-1 or literal-1 is multiplied by the value of identifier-2 or literal-2. The product is then stored in the data items referenced by identifier-3.
For all formats:
For format-2:
identifier-3, the GIVING phrase identifier, is the only identifier in the MULTIPLY statement that can be a date field.
If identifier-3 names a date field, see Storing arithmetic results that involve date fields for details on how the product is stored in identifier-3.
Floating-point data items and literals can be used anywhere a numeric data item or literal can be specified.
When the ARITH(COMPAT) compiler option is in effect, the composite of operands can contain a maximum of 30 digits. When the ARITH(EXTEND) compiler option is in effect, the composite of operands can contain a maximum of 31 digits. For more information, see Arithmetic statement operands and the details on arithmetic intermediate results in the COBOL for Windows Programming Guide.
For formats 1 and 2, see ROUNDED phrase.
For formats 1 and 2, see SIZE ERROR phrases.
This explicit scope terminator serves to delimit the scope of the MULTIPLY statement. END-MULTIPLY permits a conditional MULTIPLY statement to be nested in another conditional statement. END-MULTIPLY can also be used with an imperative MULTIPLY statement.
For more information, see Delimited scope statements.