Calculates the sum of two values.
►►─── ADD arithmetic-expression to variable ─── options ── . ────────────►◄
Expansion of options
►───┬─────────────────────────────────┬──────────────────────────────────────►◄ ├─ ROUNDED ───────────────────────┤ ├─ TRUNCATED ─────────────────────┤ └─ ALLOWING assignment-condition ─┘
Specifies the value being added to the value in variable.
Specifies the field that contains the value to which arithmetic-expression is added. Following execution of the command, variable contains the result of the ADD operation.
Rounds the result of the addition to the number of decimal positions found in variable.
Truncates the result of the addition to the number of decimal positions found in variable.
The default specification is ROUNDED if COBOL moves are enabled is not selected and TRUNCATED if the option is selected.
More information:
For more information, see 13.4, "Assignment Command" later in this chapter.
Specifies which error conditions would normally abend and should cause control to be returned to the dialog for error handling. The list of allowable assignment-condition names can be found in the section entitled "Arithmetic and Assignment Command Status Condition."
The ADD command is used to perform addition. A variable data field value, a numeric literal, or the result of an arithmetic expression is added to a data field value. The result is placed in the data field that contains the right operand.
Example
The following example uses the ADD command to add the value 1 to the contents of the variable data field COUNTER.
ADD 1 TO COUNTER.
|
Copyright © 2014 CA.
All rights reserved.
|
|