IF = 'SCREEN'

SUBTRACT Syntax Diagram

ELSE

SUBTRACT

ENDIF

Basic form

SUBTRACT n1 FROM n2.

Effect

Subtracts the contents of n1 from the contents of n2 and stores the result in n2.

This is equivalent to: n2 = n2 - n1.

Example

DATA NUMBER TYPE P VALUE 3,
     RESULT TYPE I VALUE 7.
SUBTRACT NUMBER FROM RESULT.

The field RESULT now contains 4; the value of NUMBER remains unchanged at 3.

Note

Performance:

The remarks about conversions and performance under COMPUTE_ARITH apply equally to SUBTRACT.
The runtime required to subtract two numbers of type I or F is approx. 2 msn (standardized microseconds). For numbers of type P, about 9 msn are needed.

Exceptions

Catchable Exceptions

CX_SY_ARITHMETIC_OVERFLOW

CX_SY_CONVERSION_OVERFLOW

Non-Catchable Exceptions

Related

COMPUTE, SUBTRACT-CORRESPONDING

Additional help

Arithmetic Calculations