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:
|
|
|
|
|
|
|
|
|
|
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:
The result is placed in the last operand specified {dest} and the other operands always remain unchanged.
If format 2 is used, the value in {source2} is moved into {dest} and then {source1} is added to {dest}.
The EQUAL (or ZERO), OVER, and LESS Condition Flags are applicable.
The rounding and truncation rules described in the section on Numeric Variables are applicable.
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.
This instruction supports the mixing of variable types (FORM and INTEGER).
Enhanced Array processing is supported.
See Also: Example Code, CALC, MOVE, Mathematical Instructions
![]() |