ILE COBOL Language Reference


MULTIPLY Statement

The MULTIPLY statement multiplies numeric items and stores the result.

The MULTIPLY statement has two formats:

MULTIPLY Statement - Format 1
 
>>-MULTIPLY--+-identifier-1-+--BY------------------------------->
             '-literal-1----'
 
   .---------------------------.
   V                           |
>----identifier-2--+---------+-+-------------------------------->
                   '-ROUNDED-'
 
>--+--------------------------------------------+--------------->
   '-+----+--SIZE ERROR--imperative-statement-1-'
     '-ON-'
 
>--+-------------------------------------------------+---------->
   '-NOT--+----+--SIZE ERROR--imperative-statement-2-'
          '-ON-'
 
>--+--------------+--------------------------------------------><
   '-END-MULTIPLY-'
 
 

In Format 1, the value of identifier-1 or literal-1 is saved. This value is multiplied by and stored in each identifier-2, in the left-to-right order in which identifier-2 is specified.

MULTIPLY Statement - Format 2 - GIVING
 
>>-MULTIPLY--+-identifier-1-+--BY--+-identifier-2-+------------->
             '-literal-1----'      '-literal-2----'
 
           .---------------------------.
           V                           |
>--GIVING----identifier-3--+---------+-+------------------------>
                           '-ROUNDED-'
 
>--+--------------------------------------------+--------------->
   '-+----+--SIZE ERROR--imperative-statement-1-'
     '-ON-'
 
>--+-------------------------------------------------+---------->
   '-NOT--+----+--SIZE ERROR--imperative-statement-2-'
          '-ON-'
 
>--+--------------+--------------------------------------------><
   '-END-MULTIPLY-'
 
 

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 each data item referenced by identifier-3.

For all Formats:

identifier-1, identifier-2
Must be an elementary numeric item.
literal
Must be a numeric literal.
identifier-3
Must be an elementary numeric or numeric-edited item.

The composite of operands is determined by superimposing all of the receiving data items. For more information on the composite of operands, see the Size of Operands.

+-------------------------------IBM Extension--------------------------------+

Floating-point data items and literals can be used anywhere a numeric data item or literal can be specified.

+----------------------------End of IBM Extension----------------------------+

Note:
Intermediate results generated during the execution of a MULTIPLY statement are system-specific and can affect program portability.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]