RPG/400 Help

SUB (Subtract)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| SUB(1/2)| Minuend       | Subtrahend      | Difference     |    + - Z      |
*---------*---------------*-----------------*----------------*---------------*

If factor 1 is specified, factor 2 is subtracted from factor 1 and the difference is placed in the result field. If factor 1 is not specified, the contents of factor 2 are subtracted from the contents of the result field.

Factor 1 and factor 2 must be numeric, and each can contain one of: an array, array element, field, figurative constant, literal, named constant, subfield, or table name.

The result field must be numeric, and can contain one of: an array, array element, subfield, or table name.

For rules for the SUB operation, see Arithmetic Operations.

See Figure "Summary of Arithmetic Operations" for examples of the SUB operation.


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