SUBTRACT is functionally the same as ADD. It returns the sum of two arithmetic values.
ADD(x,y,p,[q])
x and y are arithmetic values, and p and q are integer constants that represent precision and scale factor, respectively.
DECLARE (PRICE, TAX) DECIMAL(5,2); . . . PUT LIST ('TOTAL COST IS' || SUBTRACT (PRICE, TAX, 6,2));
The parameter q must not be specified unless the result type is decimal.
Description
SUBTRACT(x,y,p) returns the arithmetic value x+y with precision and scale (p,0). ADD(x,y,p,q) returns x+y with precision and scale (p,q). The result has the common data type of x and y. If the arguments differ, they are converted as described in the section Arithmetic to Arithmetic Conversion in the chapter Data Type Conversions.
The ADD function can also be used for subtraction. To subtract, precede the operand to be subtracted with a minus sign.