ADD


ANSI

 

The ADD instruction adds the contents of the source operand to the contents of the second operand can, optionally, place the result in a third operand. It uses one of the following formats:

 

(1)

[label]

ADD

{source}{sep}{dest}

(2)

[label]

ADD

{source1}{sep}{source2}{sep2}{dest}

 

Where:

label

Optional. A Program Execution Label.

source

Required. A Numeric Variable, numeric Literal, or Expression that is added to the {dest} variable.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

dest

Required. A Numeric Variable to which the {source} variable is added.

source1

Required. A Numeric Variable, numeric Literal, or Expression that is added to the {dest} after the {source2} variable has been moved to {dest}.

sep2

Required. A comma or the keyword GIVING.

source2

Required. A Numeric Variable that is moved to {dest} before the {source1} variable is added to {dest}.

Flags Affected: LESS, OVER, ZERO

Note the following:

  1. The result is placed in the last operand specified {dest} and the other operands always remain unchanged.

  2. If format 2 is used, the value in {source2} is moved into {dest} and then {source1} is added to {dest}.

  3. The EQUAL (or ZERO), OVER, and LESS Condition Flags are applicable.

  4. The rounding and truncation rules described in the section on Numeric Variables are applicable.

  5. If the environment variable PLB_ROUND is present, the result is rounded in accordance with the ANSI PL/B specification. Otherwise, the source operand is aligned and rounded, as applicable, to the destination operand's format.

  6. This instruction supports the mixing of variable types (FORM and INTEGER).

  7. Enhanced Array processing is supported.

 

 

See Also: Example Code, CALC, MOVE, Mathematical Instructions

 



PL/B Language Reference Mathematical Instructions ARCCOS