Previous Topic: Work Fields and the DEFINE Statement

Next Topic: Work Fields and the COMPUTE Statement


Work Fields and the DEFINE(K) Statement

DEFINE(K) is a special form of the DEFINE statement that does essentially what the DEFINE statement does, except that the value assigned to the work field is not reset when a new record is processed. The value of the field remains unchanged unless you explicitly change it with a COMPUTE statement. CA JARS Wizard does not accumulate totals for work fields created with DEFINE(K).

Example:

DEFINE ACTR EQ 5
DEFINE(K) BCTR EQ 5
COMPUTE ACTR EQ ACTR + 1,
        BCTR EQ BCTR + 1
LIST ACTR, BCTR

In this example, the ACTR column in the report contains 6 for the first record, 6 for the second record, 6 for the third record, etc.

The BCTR column, however, contains 6 for the first record, 7 for the second record, 8 for the third record. Assuming only three records in the file, at grand total time, ACTR contains 18, BCTR contains 8.