Subject: | |
From: | |
Reply To: | |
Date: | Thu, 2 Jan 1997 13:22:50 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hi all,
Leonard Berkowitz asked me for a better description of the ESCAPE command
and with his permission here is my reply:
On Jan 2, 8:03am, [log in to unmask] wrote:
>> :ESCAPE allows you to propogate error codes up to the next :CONTINUE
>> "marker".
> What does this mean? I find that :ESCAPE will terminate the job or
> command file.
The ESCAPE command (introduced in Release 2.1) causes the CI to execute its
error handling code as if a real error occured. This means that the CI will
execute the command following the command protected by an active :CONTINUE,
or if no CONTINUE is active, the CI will terminate jobs and prompt sessions.
BTW, "active" continue means that a CONTINUE was just executed or a CONTINUE
command is protecting a script, eg.:
continue
xeq script
ESCAPE is probably most interesting when used in a script, although it is
useful for terminating jobs in an error state -- "REMAINDER OF JOB FLUSHED".
ESCAPE differs from the RETURN command in two ways:
1) RETURN only exits back one level, whereas ESACAPE can exit out of
nested scripts,
2) RETURN (currently) does not return a value, but ESCAPE can set the
CIERROR and HPCIERR CI variables.
Example:
file1:
-----
cmd1
continue
cmd2 ---> cmd2:
-----
cmd2a
cmd2b
escape 999
cmd3
In this example script1 executes script "cmd2". If any command in "cmd2"
fails execution resumes back in "file1" at "cmd3". This is also true if
"cmd2" invokes the ESCAPE command, as shown. If "file1" did not have the
CONTINUE active then the ESCAPE in "cmd2" acts just like any other error:
terminates a job or re-issues the prompt for a session. This example
also sets HPCIERR and CIERROR to 999, which "cmd3" could test.
regards,
Jeff Vance, CSY
--
|
|
|