HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4-: 141
The SUBEND statement is legal only in a subprogram. It is illegal in the
main program or a multi-line function.
It is good programming practice to end a subprogram with a SUBEND
statement, and use SUBEXIT statements within the subprogram. The SUBEND
statement can appear more than once within a subprogram, and it need not
be the last line. One subprogram ends where the next subunit begins, or
where the program ends.
SUBEXIT
The SUBEXIT statement returns control to the program unit that called the
subprogram. SUBEXIT can be used to exit a subprogram prior to execution
of the SUBEND statement. Like the SUBEND statement, the SUBEXIT
statement returns control to the statement following the CALL statement
that called the subprogram. Although the SUBEXIT statement can be
entered as either SUBEXIT or SUB EXIT, HP Business BASIC/XL will always
enter it as SUBEXIT.
Syntax
{SUBEXIT }
{SUB EXIT}
The SUBEXIT statement is optional. If a program does not contain one,
execution of the SUBEND statement returns control to the calling program
unit.
A program can contain more than one SUBEXIT statement. Usually, a
SUBEXIT statement is executed conditionally.
Example
10 READ A,B
20 CALL Sub(A,B) !Control transfers to line 100
30 PRINT "DONE"
80 DATA 1,2
99 END
100 SUB Sub(X,Y) !Start of Subprogram
105 INTEGER Z
110 IF X<0 THEN SUBEXIT !If X < 0, control returns to line 30
120 LET Z=X+Y
130 IF Z<0 THEN SUBEXIT !If Z < 0, control returns to line 30
140 PRINT Z
999 SUB END
A SUBEXIT statement is legal only in a subprogram. SUBEXIT is illegal in
a main program or multi-line function.
SUBPROGRAM
The SUBPROGRAM statement is the long form of the SUB statement. Refer to
the SUB statement for information.
SUPPRESS AT
The SUPPRESS AT statement allows the Report Writer to produce a report at
particular summary levels. All output from lower numbered levels are
executed. Those sections with levels at or higher than the indicated
level are not executed. Except for the printout reduction, a report is
produced exactly as if all sections were being printed. That is, all
breaks occur normally and all totals are accumulated.
There cannot be more than one SUPPRESS AT statement in a report
description.