Previous Topic: MOVE CommandNext Topic: NOTE Command


MULTIPLY Command

(Area 3)

The MULTIPLY command algebraically multiplies a predefined numeric field by a specified numeric constant or the contents of another predefined numeric field. TIMES can be used in place of BY in the following command.

The format of the MULTIPLY command is as follows:

►►─┬──────────┬─ MULTIPLY ─ fieldname1 ─┬──────┬─┬─ fieldname2 ───────┬───────►
   └─ label: ─┘                         └─ BY ─┘ └─ numeric constant ─┘

 ►─┬───────────────────────────┬─┬─────────┬──────────────────────────────────►◄
   └─┬──────────┬─ fieldname3 ─┘ └─ ROUND ─┘
     └─ GIVING ─┘
label:

Specifies an optional identifying label, referenced within a GOTO command, that allows a GOTO branch to be made to this statement.

fieldname1

Specifies the name given a predefined numeric field whose value represents the multiplicand for the multiplication of two variables. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

fieldname2

Specifies the name given a predefined numeric field whose value represents the multiplier for the multiplication of two variables. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

numeric constant

Specifies an absolute numeric constant to be used as the multiplier in the calculation.

fieldname3

Optionally specifies a predefined numeric field in which the product will be placed. Predefine the field name as zoned decimal, packed decimal, binary, or unsigned binary.

ROUND

Optionally defines whether the result will be rounded before being placed into the result field. For rounding to occur, the computed value must have more decimal places than the result field. The default is not to round.

Example

           Predefined field name:     FIELD1     FIELD2     FIELD3     INDEX
 		  Numeric precision:       3.2        1.4        3.4       2.0
          Initial value of field:    (123.45)   (2.0005)    (Zero)      (3)
    MULTIPLY FIELD1 BY 2              246.90         nc        nc        nc
    MULTIPLY FIELD2 BY INDEX              nc     6.0015        nc        nc
    MULTIPLY FIELD1 BY FIELD2
         GIVING FIELD3                    nc         nc   246.9617       nc
    MULTIPLY FIELD1 BY -1.5          -185.17         nc         nc       nc
    MULTLPLY FIELD2 BY 3
         GIVING FIELD3                    nc         nc     6.0015       nc
    MULTIPLY INDEX BY INDEX               nc         nc         nc        9
    MULTIPLY FIELD3 BY INDEX              nc         nc     0.0000       nc
    MULTIPLY FIELD1 INDEX FIELD2          nc     0.3500         nc       nc
    MULTIPLY INDEX BY FIELD3              nc         nc         nc        0
    MULTIPLY INDEX TIMES 16               nc         nc         nc       48
    MULTIPLY FIELD1 TIMES +.92        113.57         nc         nc       nc
    MULTIPLY FIELD2 BY .333               nc     0.6661         nc       nc

Note the following: