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.
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:
- 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).
- 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.
- 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
- Take care that the value in the accumulator does not go negative. Otherwise results are unpredictable.
- 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: