Previous Topic: When to Use SELECT and When to Use Type 7 LogicNext Topic: Combining Tasks for Multiple Reports


Avoiding Unnecessary Logic

Obviously, stream lined code is more efficient than code that generates unnecessary processing.

In the example below, a call for the current date is executed for each record in the input file by processing user module US10:

          017 CALL US10 ( 2 CURRENT-DATE )

The code below shows one method of calling the user module one time for the report, thereby avoiding unnecessary processing. The call executes only when the switch value is Y:

          010 FIRST-TIME-SW 'Y'
           .
           .
           .
          017     FIRST-TIME-SW EQ 'N' 010
          017     MOVE 'N' FIRST-TIME-SW
          017     CALL US10 ( 2 CURRENT-DATE) $Executes only on first record
          017010      ...