Writing an Exception Handler
Developing TACL Routines
107365 Tandem Computers Incorporated
3–27
Figure 3-16. Sample Command Shell (Page 1 of 4)
?SECTION restrictive_command_shell ROUTINE
#PUSH #OUTFORMAT
#SET #OUTFORMAT PRETTY
== Define the code that handles exceptions
[#CASE [#EXCEPTION]
|_CALL|
#FRAME
#PUSH err cmd prompt condition recovery
#PUSH name step
#SET condition 0
display_initial_message
|_BREAK|
#OUTPUT /HOLD/ BREAK key hit during~_
[#OUTPUT [#IF NOT [#EMPTYV name] |THEN|
[name] at step [step]
|ELSE|
input
] == end of #IF
] == end of #OUTPUT
#SETMANY condition recovery , 1 REQUIRED
|_ERROR|
#OUTPUT Error occurred during [name] at step
#OUTPUT [step]
#ERRORTEXT /CAPTURE err/
#OUTPUT The error is:
#OUTPUTV err
#SETMANY condition recovery , 1 REQUIRED
|EOF|
#OUTPUT CTRL/Y will not break me
|EXIT|
#RESET FRAMES RESULTS
#RETURN
]
== Body of the routine--enable four exception types:
#FILTER _BREAK _ERROR EOF EXIT
#OUTPUT
[#LOOP |DO|
[#IF condition = 1 |THEN|
#SET prompt An error condition exists--select &
COLDSTART or SHUTDOWN:~_~_
|ELSE|
#SET prompt Select WARMSTART, COLDSTART, SHUTDOWN, &
or EXIT:~_~_
]