MULTIPLY Statement [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
 
  
  
  
 
HP COBOL II/XL Reference Manual
MULTIPLY Statement 
The MULTIPLY statement multiplies a number by one or more other numbers
and stores the result in one or more locations.
Syntax 
The MULTIPLY statement has the following two formats:
            
Parameters 
identifier-1,         numeric elementary items, except that in format 2,
identifier-2, and so  each identifier following the GIVING keyword may be
forth                 numeric-edited elementary items.
literal-1 and         any numeric literal.
literal-2 
Description 
The composite of operands (that is, the hypothetical data item resulting
from the superimposition of all receiving data items aligned on their
decimal points) in any given MULTIPLY statement must not contain more
than 18 digits.
The ROUNDED, SIZE ERROR, and  NOT ON SIZE ERROR phrases, as well as
multiple results and overlapping operands, are described in Chapter 8
.
When you use format 1 of the MULTIPLY statement, literal-1 or the
contents of identifier-1 is multiplied, in turn, by the identifiers
following the BY keyword.  The result of each multiplication is stored in
each of the identifiers following the BY keyword immediately after that
particular product is determined.
When format 2 is used, the value of identifier-1 or literal-1 is
multiplied by the value of identifier-2 or literal-2, and the resulting
product is stored in each identifier following the GIVING keyword.
Examples 
     MULTIPLY 2 BY ROOT, SQ-ROOT, ROOT-SQUARED.
If ROOT has the value 2, SQ-ROOT the value square root of 2 (1.41), and
ROOT-SQUARED the value 4, then the above MULTIPLY statement results in
ROOT having the value 4, SQ-ROOT having twice the value the square root
of 2 (2.82), and ROOT-SQUARED having the value 8.
Assuming ROOT to be 2, the following MULTIPLY statement assigns the value
4 to ROOT-SQUARED:
     MULTIPLY ROOT BY ROOT GIVING ROOT-SQUARED.
 
  
  
  
 
 MPE/iX 5.0 Documentation