HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
7-2
WITH and USING Clauses
The WITH and USING clauses control the automatic page break mechanism and
to aid in the printing of each section. The WITH and USING clauses can
occur in all of the Report Writer section statements except END REPORT
DESCRIPTION and in the DETAIL LINE statements. These clauses are both
optional; however if both clauses occur, the WITH clause must appear first.
The USING clause is an
implicit
PRINT USING statement.
[LINES]
Syntax. WITH
num_lines
[LINE ]
USING
image
[;
output_list
]
Parameters.
num_lines
The maximum number of lines the section statement
expects to need. This can be any non-negative integer,
including zero. This number reflects ALL output done by
the section. For DETAIL LINE, all lines printed between
any two detail lines is included.
image
An image string or a line reference to an IMAGE line to
control printing.
output-list
A list of output items, identical to the list used by
the PRINT USING statement.
Examples. The following are examples of the WITH and USING clauses:
100 REPORT HEADER WITH 3 LINES
110 DETAIL LINE USING 100;A, B
120 PAGE TRAILER WITH 2 LINES USING Pt;PAGENUM, DATE$
Whenever a section becomes active, the first action executed is the
section statement. The WITH clause is evaluated first. If the number of
lines left on the page is smaller than the WITH value, an automatic page
break results. Otherwise, the WITH clause has no effect.
The WITH clause ensures that a certain number of lines are available
before the page trailer prints. If this condition is not satisfied, the
page break ensures that enough lines are available. If a WITH clause is
not present, the default is one.
The USING clause executes after the WITH clause. This clause is similar
to a PRINT USING statement in the report section statement. See PRINT
USING for more details.
If an error occurs during evaluation of the WITH clause, such as a
negative number of lines specified, the USING clause does not execute.
If the USING clause encounters an error, it stops printing. In either
case, however, the rest of the report section executes. That is, if
there is an error in the WITH clause, the USING clause will not execute,
but the rest of the section will execute.
Exceptional Cases. The WITH clauses of the PAGE HEADER and PAGE TRAILER
sections are exceptional. Instead of evaluating the WITH clause at each
page break, the Report Writer evaluates the PAGE HEADER and PAGE TRAILER
size only when BEGIN REPORT executes. This action allows the Report
Writer to define the number of lines normally available for printing.
The maximum size of the page header and the size of the page trailer are
fixed throughout the report. Refer to the PAGE HEADER and PAGE TRAILER
statements for more details.
The USING clauses of the PAGE HEADER and PAGE TRAILER sections are
evaluated each time there is a page break.
Report Writer Block Statements
The Report Writer block statements further define a report by providing
execution control as well as report layout. All of these statements must
occur within a report description. Some of the statements must occur
within certain sections of the report. The point each statement becomes
busy at, or is evaluated, varies from statement to statement.