The SUBTRACT statement decreases the value of numeric fields. You can use SUBTRACT as an alternative to the SET statement.
This statement has the following format:
{numeric_field }
SUBTRACT {numeric_literal } FROM {numeric_field}
{alphanumeric_field} {date_field }
{date_field }
For more information about numeric_field, numeric_literal, alphanumeric_field, and date_field, see the PDL Language Concepts topic in the "Procedure Definition Language Concepts and Language Elements" chapter.
During execution, both the source and the target fields must contain numeric values or a runtime error occurs.
SUBTRACT operands do not have to have the same decimal precision. When an expression with decimal places is subtracted from a field with an integer value, the subtraction is performed and an attempt is made to put the result into the receiving (FROM) field. If the value is too long, the decimal portion of the value is truncated. If the value that results from the truncation is still too long, a runtime error occurs.
You do not have to define the operands of a SUBTRACT statement with the same number of digits. However, an error occurs if the first operand is longer than the second operand or if the operation results in a value that is longer than the second operand.
Examples
SUBTRACT CHARGE FROM BALANCE
SUBTRACT 200 FROM NET_INCOME
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|