The ADD statement increases the value of numeric fields. You can use ADD as an alternative to the SET statement.
This statement has the following format:
{numeric field } { }
ADD {numeric literal } TO {numeric field }
{alphanumeric field} {date field }
Specifies a field with a type of N (numeric) or U (unsigned numeric) and a numeric value.
Limits: 31 digits
Specifies any series of 1 to 31 digits, with one optional decimal point and no embedded blanks, optionally preceded by a sign (+ or ‑).
Specifies a field with a type of X.
Limits: 32,000 characters
Specifies a field with a type of D. The date field has a numeric value indicating an integer number of days from December 31, 1900 (day zero), plus or minus.
During execution both the source and the target fields must contain numeric values or a run-time error occurs.
ADD operands do not have to have the same decimal precision. When you add an expression with decimal places to a field with an integer value, the addition is performed and an attempt is made to put the result into the receiving 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 an ADD statement with the same number of digits. However, an error occurs if the operation results in a value that has more significant digits than the second operand can contain.
Example
ADD MONTH_SALES TO YEAR_SALES ADD 200 TO NET_INCOME
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|