pTAL Reference Manual (H06.03+)
Statements
HP pTAL Reference Manual—523746-005
12-3
ASSERT
ASSERT
The ASSERT statement conditionally calls the procedure specified in the active
directive ASSERTION on page 17-18.
assert-level
is an integer in the range 0 through 32,767.
If assert-level is greater than or equal to the assertion-level specified in
the active ASSERTION directive and if condition is true, the program calls the
procedure specified in the active ASSERTION directive.
condition
is a conditional expression (see Conditional Expressions on page 5-15).
To use the ASSERT statement and the ASSERTION directive together for debugging
or error-handling:
1. Put an ASSERTION directive in the source code, specifying an assertion-
level and an error-handling procedure.
2. Put an ASSERT statement at each place where you want to execute the error-
handling procedure when an error occurs. In each ASSERT statement, specify:
°
An assert-level that is greater than or equal to the assertion-level
°
A condition that will be true when an error occurs
During program execution, if an assert-level is greater than or equal to the active
assertion-level and the associated condition is true, the program calls the
error-handling procedure.
Example 12-1. Null Compound Statement
BEGIN
END;
Example 12-2. Compound Statement
BEGIN
a := b + c;
d := %B101;
f := d - e;
END;
ASSERT assert-level : condition
VST035.vsd










