HP 3000 Manuals

GRAND TOTALS [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

GRAND TOTALS 

The GRAND TOTALS statement provides an easy means for automatic
accumulation of numeric data in the Report Writer.  The GRAND TOTALS
statement provides totaling for an entire report.

The GRAND TOTALS statement must appear in the REPORT HEADER, REPORT
TRAILER, or REPORT EXIT section.  Each report description can have only
one such statement.

Syntax 

                           [{,}         ]
GRAND TOTALS [ON] num_expr [{;} num_expr]...

Parameters 

num_expr         Any numeric expression can be totaled.  There can be as
                 many expressions as desired.  When referring to a
                 particular total, a sequence number is used.  The first
                 expression is sequence number 1, the second is number 2,
                 and so on.

Examples 

     100 GRAND TOTALS Sales, Commission, Quantity

The BEGIN REPORT statement makes the GRAND TOTALS statement busy and it
remains busy until an END REPORT or STOP REPORT statement executes.  The
GRAND TOTALS statement is used ONLY if contained in a HEADER or TRAILER
section with a nonzero level number.  BEGIN REPORT sets all accumulated
totals to zero.

The GRAND TOTALS calculation occurs when a DETAIL LINE statement
executes, but only when the totals flag of the DETAIL LINE is nonzero.
The accumulated values are reset to zero for any summary level where a
break occurs.  This is done after the TRAILER sections print.  After all
break conditions are processed, the totals accumulate.

TOTALS statements are evaluated starting with GRAND TOTALS and working to
level nine.  For each statement, the expressions are evaluated from left
to right.

All totals are stored in either REAL or DECIMAL data type, depending on
the data type option in effect when the report started.  However, the
expressions themselves are evaluated like any other expression in HP
Business BASIC/XL. This means that an individual expression can cause an
overflow error without causing an overflow in the total.



MPE/iX 5.0 Documentation