HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

4- 150
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 TOTALS ON My_var, TRUNC(Sales), Quantity*100
The BEGIN REPORT statement makes the TOTALS statement busy and it remains
busy until an END REPORT or STOP REPORT statement is executed. The
TOTALS statement is used ONLY if contained in a HEADER or TRAILER section
with a nonzero level number. There can only be one TOTALS statement per
summary level. All accumulated totals are set to zero by BEGIN REPORT.
The 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 are printed. After all break
conditions are processed, the totals are accumulated.
The TOTALS statements are evaluated starting with GRAND TOTALS and
working to level nine. For each statement, the expressions are evaluated
from left to right. The value of each expression is added to previous totals.
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 as any other expression in HP
Business BASIC/XL. This means that an individual expression may cause an
overflow error without causing an overflow in the total.
TRAILER
The TRAILER statement allows you to define logical levels for separating
and summarizing data printed in a report. The TRAILER section is used to
print trailing data for a particular level in the report of which there
are nine levels available.
In order to define a report level, there must be a TRAILER or HEADER
statement in the report description. However, there can not be more than
one TRAILER section for a single level within the report description. If
no WITH or USING clause is present, the statement produces no output.
However, other statements in this section might produce output.
Syntax
[ [LINES]]
TRAILER
level_number
[WITH
num_lines
[LINE ]]
[USING
image
[;
output_list
]]
Parameters
level_number
A numeric expression with a value from 0 to 9. This
defines the
summary
or
break
level for this trailer
section. This number is used to create different
summary levels for data, and to cause breaks in the
report at appropriate times. A level of zero causes the
entire section to be ignored.
num_lines
The maximum number of lines expected to be needed by the
section statement. This number reflects ALL output done
by the section.
image
An image string or a line reference to an IMAGE line.
output-list
A list of output items, identical to the list used by
the PRINT USING statement.