HP TACL Programming Manual page 82

Tandem advanced command language
Table of Contents

Advertisement

Developing TACL Routines
Writing an Exception Handler
3–26
When you invoke restricted_cmd_processor, the output looks like this:
16> restricted_cmd_processor
Enter cmd: add
ADD
Enter cmd: clr
Invalid command
TACL error occurred.
Enter cmd: <BREAK>
BREAK key pressed.
Enter cmd: exit
17>
By using the definitions in Figure 3-16, a user can start and stop an application. (In the
example, there is no code to start an application; the code performs a delay sequence
to simulate application activity.)
The definitions in Figure 3-16 use the following global variables:
Condition is an error flag; if 0, there is no error; if 1, there is an error, and
recovery might be necessary.
Recovery indicates the need to run a routine to clear local variables. If OFF,
recovery is not necessary; if ON, recovery is necessary.
The shell supports the following commands:
Coldstart —Pops old variables if necessary, pushes new variables, sets the
condition and recovery variables, and then starts the application. If the user
presses BREAK during this time, the exception handler sets the condition and
recovery flags.
When finished, coldstart resets the condition and recovery flags.
Warmstart—Attempts to purge a file with an invalid file name; this attempt
forces a TACL error to show exception handler operation.
Shutdown —Performs a cleanup operation and sets condition to 0.
Exit—Tests the condition variable and does not allow the user to exit until the
error is resolved. If condition is 0, exit raises the user-defined EXIT exception
and exits the shell.
Variables a, b, c, d, e, f, g, and h are created but are not used in this example; they are
deleted during the cleanup phase before exiting.
If an error occurs during coldstart or warmstart, the user cannot exit the shell
until a successful coldstart or shutdown occurs.
For this example, the keep handler returns if you enter an exit command. Usually, a
keep handler would not provide an exit mechanism.
107365 Tandem Computers Incorporated

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents