# SUB (Subtract)

Code |
Factor 1 |
Factor 2 |
Result Field |
Indicators |
||
---|---|---|---|---|---|---|

SUB (H) |
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 1 for examples of the SUB operation.