Previous Topic: What You Can DoNext Topic: Multiple-level Subtotals


Demonstration

Objective

This report prints account balances for several branch offices and computes an average branch balance.

Procedure

Complete Code

col. 2
▼
REC CURRENT-BAL    4   8   2  DP=2
01OUT T
01SORT BRANCH 0                          $Control break for branch number
010 PRINT1  'BRANCH'
010 COUNT
010 AVERAGE DP=2
013 SUMMARY REPORT OF AVERAGE TRANSACTIONS
0141*001 ' '
0151*010   CURRENT-BAL
01610020   PRINT1
01610027   BRANCH                        $Prints BRANCH value
01610031   'TOTAL BALANCE'
01610045   CURRENT-BAL SZ=11
016200310  'TOTAL BALANCE'
01620045   CURRENT-BAL SZ=11            $Prints branch totals
016300310  'AVERAGE PER BRANCH'
01630050   AVERAGE     SZ=11             $Prints the average
018        IF LEVL EQ 2  200              $Test for grand-total time
018        COUNT + 1  COUNT
018        TAKE 1                         $Prints branch information
018200     CURRENT-BAL / COUNT AVERAGE  $Uses the grand total of CURRENT-BAL
018        TAKE (2 3)                     $Prints type 6 lines 2 and 3

Result

REPORT NO. 01      SUMMARY REPORT OF AVERAGE TRANSACTIONS     mm/dd/yy PAGE     1                     BRANCH 001 TOTAL BALANCE     999,999.99                     BRANCH 010 TOTAL BALANCE   1,358,349.11                     BRANCH 011 TOTAL BALANCE     345,678.90                     BRANCH 020 TOTAL BALANCE     345,575.18                                TOTAL BALANCE   3,049,603.18                                AVERAGE PER BRANCH     762,400.80