5-8 Command Reference
ADD
Purpose Adds the numeric values of two fields.
Syntax ADD
buffer-field1
,
buffer-field2
[ , [
invalid label
] [ ,
valid label
] ]
Process The ADD command sums
buffer-field1
and
buffer-field2
and places the result into
buffer-field2
.
The
buffer-field
fields can be one of the following:
Buffer-field 1
and
2
Description
INPUT Input Buffer
Logical Field Name (TEMP1) Temporary Buffer
Field
Logical Field Name (LU1) Lookup Buffer Field
Logical Field Name (PR1) Printer Buffer Field
Logical Field Name (Field1) [Index] Array Buffer Field
Buffer-field1
only: Number prefixed by
the number sign (#)
Rules: Both fields must be numeric.
The DEFINE command defines the index.
Optional Fields
Invalid
and
valid labels
are discussed in "Script Flow" at the beginning of this
chapter.
Example 1
This example adds the contents of WHOLESALE to TEMP2. Control passes to the
next line.
ADD WHOLESALE,TEMP2
Example 2
This example assigns TEMP1 the sum of CONTROL and TEMP1. If TEMP1
overflows, control passes to the invalid label *ERROR2. If TEMP1 does not
overflow, control passes to the next line.
ADD CONTROL,TEMP1,*ERROR2
See Also DEC
INC
SUB
MULTIPLY
DIVIDE