RPG/400 Help

ADD (Add)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| ADD(1/2)| Addend        | Addend          | Sum            |    + - Z      |
*---------*---------------*-----------------*----------------*---------------*

If factor 1 is specified, the ADD operation adds it to factor 2 and places the sum in the result field. If factor 1 is not specified, the contents of factor 2 are added to the result field and the sum is placed in the result field. Factor 1 and factor 2 must be numeric and can contain one of: an array, array element, constant, field name, literal, subfield, or table name. For the rules for specifying an ADD operation, see Arithmetic Operations.

Figure 6. ADD Operations

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*
C* The value 1 is added to RECNO.
C                     ADD  1         RECNO
C* The contents of EHWRK are added to CURHRS.
C                     ADD  EHWRK     CURHRS
C* The contents of OVRTM and REGHRS are added together and
C* placed in TOTPAY.
C           OVRTM     ADD  REGHRS    TOTPAY


[ Top of Page | Previous Page | Next Page | Table of Contents ]