TOTAL, MIN and MAX Connectives

The TOTAL connective tells the processor to accumulate and display the total values of a numeric attribute at each control break and for the cumulative total.

The MIN connective specifies output of the minimum numeric value of the attribute, since the last control break at the same level, at each control break.

The MAX connective is like MIN but outputs a maximum.

You can use the GRAND-TOTAL modifier to specify text to be displayed on the last total line.

You can also use TOTAL in conjunction with the BREAK-ON connective to display intermediate totals at the control breaks.

Syntax

[TOTAL || MIN || MAX] attribute {print-limiter}

Syntax Elements

TOTAL Keeps a running total of a numeric attribute.

MIN Specifies output minimum numeric value at control break.

MAX Specifies output maximum numeric value at control break.

attribute The item-id of a data definition item.

print-limiter Has the form:

{NOT} {relational-operator} "value-string"
{{logical-connective} {
NOT} {relational-operator} "value-string"}...

Rule

The attribute to which the connective applies must immediately follow it.

Examples

The following sentence causes the processor to keep a running total of attribute BILL-TOTAL and to display the total at the end of the listing.

:LIST GUESTS WITH BILL-TOTAL < "200.00" TOTAL BILL-TOTAL
LAST-NAME HDR-SUPP (P
GUESTS   Bill Total    Last Name
401         $149.25    Palmer
147         $122.82    Janson
318         $173.21    Petrillo
234         $186.98    McSweeney
.               .      .
365         $159.70    Ferguson
***       $2,662.63

To list the last name before the bill total, enter the output selection before the TOTAL modifier as follows:

:LIST GUESTS WITH BILL-TOTAL < "200.00" LAST-NAME TOTAL BILL-TOTAL HDR-SUPP (P

The attribute associated with the TOTAL modifier can be a dependent attribute, as well as an independent or controlling attribute. However, to use a dependent attribute with the TOTAL modifier, the controlling attribute must be printed to the left of the dependent attribute as in the following example. Note the asterisk at the "Amount" column. This indicates that the attribute is dependent.

:SORT GUESTS WITH BILL-CODE = "18" BY ROOM BILL-CODE TOTAL
BILL-AMOUNT LAST-NAME HDR-SUPP
GUESTS   Bill  Amount..  Last Name
         Code
               *
117         2  $62.00    Rizzo
            6  $17.95
           18   $8.76
140         2  $55.00    Lynch
            6  $34.95
            9  $17.00
           18  $18.76
143        15  $12.95    Hennessey
           12  $22.50
           18   $2.95
            8   $7.95
***           $260.77

The following example is similar but shows the use of a print limiter with BILL-CODE and the MIN connective with BILL-AMOUNT:

:SORT GUESTS WITH BILL-CODE = "18" BY ROOM BILL-CODE "18" MIN
BILL-AMOUNT LAST-NAME HDR-SUPP
GUESTS   Bill  Amount..  Last Name
         Code
               *
117        18   $8.76    Rizzo
140        18  $18.76    Lynch
143        18   $2.95    Hennessey
***             $2.95