AMT Help Files

ADD

Input

COBOL Java
ADD Normal Java addition OR add

Syntax

NumericValue add (NumericValue, NumericValue)

Parameter(s)

<NumericValue var1>
Add this value to the value found in the second parameter.

<NumericValue var2>
This value is added on to with the value found in the first parameter.

ADD data types
The 'ADD' keyword is used for the following data types: double, long, NumericValue, AlphaValue. Otherwise, normal Java addition is used.

Example(s)

77 A    PIC 9(2).
77 B    PIC 9(2).
77 C    PIC 9(2).
77 D    PIC 9(2).
77 K    PIC 9(4)V99 value 1.23.
77 R    PIC 9.99.
COBOL Java
ADD 1 TO A.
                
locDef.a.assign(locDef.a.getIntValue() + 1);
                
ADD A TO B.
                
locDef.b.assign(locDef.b.getIntValue() + locDef.a.getIntValue());
                
ADD 1.23 TO K.
                
locDef.k.assign(add(locDef.k.getNumericValue(), 1.23));
                
ADD A TO B GIVING C.
                
locDef.c.assign(locDef.b.getIntValue() + locDef.a.getIntValue());
                
ADD A B TO C D.
                
setAuxiliary(locDef.a.getIntValue() + locDef.b.getIntValue());
locDef.c.assign(locDef.c.getIntValue() + auxiliaryNative);
locDef.d.assign(locDef.d.getIntValue() + auxiliaryNative);
                
ADD K TO A ROUNDED.
                
locDef.a.assign(round(locDef.a, add(locDef.a.getIntValue(), locDef.k.getNumericValue())));
                
ADD 1.23 TO K GIVING R ROUNDED.
                
locDef.r.assign(round(locDef.r, add(locDef.k.getNumericValue(), 1.23)));
                
ROUNDED syntax
See COMPUTE for the 'ROUNDED' syntax.