ADD

Use the ADD script function to return the sum of two values as a 16-digit alphanumeric string with leading zeros.

Syntax

ADD (Operand1, Operand2)

Parameters

Notes:

Tip: You can remove leading zeros and otherwise edit the format of results with the FORMAT script function.

Return Code

The script function returns the result of the addition.

Examples

The following example stores the result of an arithmetic operation that adds two values in a script variable. Operand1 and Operand2 are numeric expressions.

:SET &RESULT# = ADD(1000,333)

The following example uses the ADD script function to define a condition:

:SET &MAXIMUM# = 3000
:
SET &RUN1# = 5000
:
SET &RUN2# = 2000 
!...

:
IF ADD(&RUN1#,&RUN2#) > &MAXIMUM#  
!...
 
:
ENDIF

The following example adds two floating-point numbers, and prints the result in the activation report:

:DEFINE &RESULT#,float
:SET &RESULT#ADD(10.31,-5.45)
:P &RESULT#

The result in the activation report would look like this:

U0020408 +0000000000000004.8600000000000000

The following example shows another way of adding numbers by setting the value of a variable with an arithmetic expression:

:SET &ADD# = 1 + 1
:
P &ADD#

The result in the activation report would look like this:

U0020408 0000000000000002

See also:

seealso

Arithmetic Calculations in Scripts