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

4-: 9
expression. The statements differ in what changes can be specified for
the control expression.
String Control Variables. When the report is activated via BEGIN REPORT,
the value of the control expression is recorded. With each DETAIL LINE,
the current value of the control expression is compared to the recorded
value in OLDCV$. If the two values are not the same, the break level is
triggered.
After any break at the specified level, the new value of the control
expression is recorded in place of the old value, OLDCV$. This process
takes place after all trailers have been output, but before headers are
printed.
Examples
BREAK 3 WHEN Sales_Office$ CHANGES
In this example, a break at level 3 occurs whenever the control
expression Sales_Office$ changes value.
Numeric Control Variables. Numeric control expressions have an optional
BY clause in the BREAK WHEN statement. If the BY clause is not present
or evaluates to zero, the statement works exactly as it does with a
string control expression. That is, a break is triggered whenever the
control expression in OLDCV changes value.
The BY clause establishes a limit value that the control expression must
exceed before a break occurs. The numeric expression in the BY clause
determines the increment by which the limit changes after a break.
However, the limit is NOT set by adding the BY expression to the control
expression.
When a BEGIN REPORT executes, the control expression is recorded and the
BY clause is evaluated. At this time, a break limit is set up as well.
This limit is set up in the following manner:
* If the BY expression is positive, the limit is set to the multiple of
the BY clause closest to, but still greater than, the control
expression.
* If the BY expression is negative, the limit is set to the multiple of
the BY clause closest to, but still less than, the control
expression.
At each DETAIL LINE, the control expression is compared to the limit
value. If the control expression is greater than or equal to the limit
(less than or equal if BY was negative), a break is triggered. After the
trailers print, but before the headers are output, a new limit is
established using the rules above. The BY clause is not reevaluated;
only the limit is changed.
The break limit is reevaluated at any break at the BREAK WHEN level.
This can be caused by breaking at this level or a lower level from a
DETAIL LINE or a TRIGGER BREAK statement.
Examples
BREAK N WHEN Product_no CHANGES
BREAK 8 WHEN Profits CHANGES BY 100000
BREAK A(1) WHEN Sales CHANGES BY -50
In the first example, a break takes place when the control PRODUCT_NO
changes value. It does not matter how much it changes, nor whether it
gets larger or smaller.
In the second example, a break occurs when the variable PROFITS exceeds a
multiple of one hundred thousand. Assuming that PROFITS has an initial
value of 50000, the first break limit is 100000. If PROFITS then changes
to 235000, break level 8 is triggered; the next break limit is set to
300000, the next multiple larger than PROFITS.
The third example is similar to the second, except that the BY clause is