With ACL-Verbs you can add and subtract using ADD and SUB but not perform other calculations like Multiplication and Division. Arithmetic is not the core function of ACL. But with two small subroutines called MULTIPLY and DIVIDE (both located in the ACLLIB which si created during installation of TPX) you can multiply and divide two numbers if necessary.

Multiplication works as follows:

The two numbers which should be multiplicated have to be defined as Variables with names MULTPLCN (multiplicand) and MULTPLER (multiplier), for the result of the multiplication the Variable called SUM needs also to be defined. All Variables need to be of Type VDEFINE or GDEFINE. If other names are desired, their names have to be changed in the ACL MULTIPLY as well.

The subroutine is called by statement

ACLPGM MULTIPLY

Example of the necessary ACL-code:

----------------------------------------------------------

VDEFINE MULTPLER,8 * DEFINE 1ST FACTOR

VDEFINE MULTPLCN,8 * DEFINE 2ND FACTOR

VDEFINE SUM,8 * RESULT

*

SET MULTPLER,value * SET 1ST FACTOR

SET MULTPLCN,value * SET 2ND FACTOR

*

CALL ACLPGM MULTIPLY * INVOKE MULTIPLICATION

----------------------------------------------------------

The result of the multiplication is available in variable SUM.

Division works as follows:

The two numbers which should be divided have to be defined as Variables with names DIVIDEND and DIVISOR, the result of the division appears in variables QUOTIENT and REMAINDR. All Variables need to be of Type VDEFINE or GDEFINE.

The subroutine is called by statement

ACLPGM DIVIDE

Example of the necessary ACL-code:

----------------------------------------------------------

VDEFINE DIVIDEND,8 * DEFINE DIVIDEND

VDEFINE DIVISOR,8 * DEFINE DIVISOR

VDEFINE QUOTIENT,8 * DEFINE QUOTIENT

VDEFINE REMAINDR,8 * DEFINE REMAINDR

*

SET DIVIDEND,value * SET DIVIDEND

SET DIVISOR,value * SET DIVISOR

*

CALL ACLPGM DIVIDE * INVOKE DIVISION

----------------------------------------------------------

The result of the division is available in variables QUOTIENT and REMAINDR.