Writing an Exception Handler
Developing TACL Routines
3–24
107365 Tandem Computers Incorporated
Figure 3-14. Returning Information From a Release Handler (Page 3 of 3)
#SETMANY filespurged filesnotpurged exclude, 0 0 0
[#CASE [#ARGUMENT /VALUE filetemplate/ TEMPLATE &
TOKEN /TOKEN !/]
|1|
|2|
#SET exclude -1
SINK [#ARGUMENT /VALUE filetemplate/ TEMPLATE]
]
[#LOOP |WHILE| 1 |DO|
handletemplate
[#CASE [#ARGUMENT /VALUE filetemplate/ COMMA TEMPLATE
END]
|1|
#IF [#ARGUMENT /VALUE filetemplate/ TEMPLATE]
|2|
|3|
#OUTPUT == blank line
#OUTPUT Number of files purged =[filespurged]
#OUTPUT Number of files not purged=[filesnotpurged]
#UNFRAME
#RETURN
]
] == end of #LOOP
Creating a Keep Exception
Handler
A keep exception handler processes exceptions but does not return to the calling
process. If, for example, you want to provide a restrictive command shell with five
commands, a keep handler allows you to process the five commands and any errors or
break conditions without exiting the routine. The user could not, then, gain access to a
standard TACL prompt.
The _CALL path is the entry point for the routine and, because control is to remain in
the routine, it is not likely to be executed repeatedly. Therefore, the _CALL path
contains the #FRAME and variable declarations that typically begin a routine.
Use the routine in Figure 3-15,
restricted_cmd_processor
, as a sample keep
exception handler. If the BREAK key is pressed while the processing loop is running,
TACL raises the _BREAK exception and reinvokes the routine; the #CASE function
takes the _BREAK path and then reenters the loop.
If the user enters anything other than ADD or SUB, the #CASE statement in the loop
raises _ERROR, and TACL reinvokes the routine; in this situation, the exception-
processing #CASE takes the _ERROR path before resuming the loop.