Tips for using Accumulators A1 - A4 in ACL Programs.

Document ID : KB000009537
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

This document describes Accumulators and their benefits for ACL/E programming. These Accumulators are predefined variables which allow you to do basich arithmetic in ACL/E. How they can be used is explained in this article.

Instructions:

ACL provides four predefined numeric variables called Accumulators. The names of these variables are A1, A2, A3 and A4. Accumulators are mainly used for loop counters e.g. when reading the lines of a screen into variables etc.

They have the following features:

  1. The scope of the Accumulator is limited to the ACL in which they are used. There is no need to define them using a VDEFINE Statement. Valid values in Accumulators are any integers between 0 and 16777215 (=2^24-1).

  2. When used in COMPARE, ADD or SUB, the value of an accumulator is referenced without the '&' otherwise it is interpreted as an implicit defined variable.

  3. When the value of an accumulator is displayed, the accumulator need to be prefixed by an '&' like every other variable:
    OUTPUT 'The Value of A1 = &A1',7/6

  4. Take care that the value in the accumulator does not go negative. Otherwise results are unpredictable.

  5. You even can multiply and divide with Accumulators. Please refer to Knowledge Document TEC461929 for details.

    Here are the possible functions which can be executed using accumulators:

    SET      An,integer 
    ADD An,An
    ADD An,integer
    SUB An,An
    SUB An,integer
    COMPARE An,An
    COMPARE An,integer