Previous Topic: Demonstration (3): Creating a Table from an Existing TableNext Topic: Retrieving Data Tables


Demonstration (4): Creating a Totals-only Table

Objective

In this example, the output table contains a summary of monthly receipts for each branch of a bank. Type 6 parameters define the name, size, and position of the table columns. One type 5 parameter accumulates daily receipts.

01OUT  T ...
*       ONLINE=YES
*       COMMENT='TOTAL MONTHLY RECEIPTS FOR EACH BRANCH'

T specifies a totals-only report.

ONLINE=YES directs ASF to create dialogs and maps for this data table.

COMMENT=' ... ' updates the comment field on the ASF Table Definition screen.

0161*001  BRANCH  FZ 
0161*002  MONTH   FZ 
0161*003  YEAR    FZ 
0161*004  MONTHLY-RECEIPTS SZ=5 FP DP=2

0161*... parameters define the name, size, and position of the table columns.

FZ and FP specify zoned and packed numeric fields respectively.

Complete Code

 IN     80   F   80
 REC    DAILY-RECEIPTS  8 10  2  DP=2
 REC    DAY      18  2  2
 REC    MONTH    20  2  2
 REC    YEAR     22  2  2
 REC    BRANCH   24  2  2
 01OUT  T  TABLE=RECEIPT-TOTALS TYPE=CREATE USER=DOC1 PW=DOC1
*          CATALOG=ASFDICT ONLINE=YES
*          COMMENT='TOTAL MONTHLY RECEIPTS FOR EACH BRANCH'
 01SORT BRANCH  YEAR  MONTH +
 010    MONTHLY-RECEIPTS
 0151*000  DAILY-RECEIPTS
 0161*001  BRANCH     FZ
 0161*002  MONTH      FZ
 0161*003  YEAR       FZ
 0161*004  MONTHLY-RECEIPTS  SZ=5  FP  DP=2
 018001    IF LEVL EQ 2   DROP
 018       MOVE DAILY-RECEIPTS TO MONTHLY-RECEIPTS