|
COBOL VERBS - ADD
MOVE ADD
ADD verb. Syntax 1 - ADD { literal-1 / data-item-1 } .. TO target-data-item-1 .. Syntax 2 - ADD { literal-1 / data-item-1 } .. GIVING target-data-item-1 .. ADD verb adds one or more numeric values and store the value into a target data item. Let us see some examples. ADD 10 TO WS-A. Before execution WS-A value is 5, after excution of above statement WS-A value will be 15. ADD WS-A WS-B GIVING WS-C. Before execution - WS-A value 100 WS-B value 150 WS-C value 786 After execution of above ADD statement, value in data items are shown below. WS-A value 100 WS-B value 150 WS-C value 250 <- sum of WS-A, WS-B moved to WS-C ADD WS-A WS-B GIVING WS-C WS-D WS-E values in WS-A WS-B will be summed up and the result will be stored in WS-C, WS-D & WS-E.
| |