:ON_ERROR
The :ON_ERROR script statement determines what happens to script processing when a script element returns a particular error or message. Use keywords with the :ON_ERROR statement to continue script processing when an error occurs, thereby allowing you to read return codes, or to cancel the script. For more information on script functions that you can use to analyze errors, see Script Elements for Error Handling.
Note: Some script elements allow you to directly define error behavior without requiring an :ON_ERROR statement.
Syntax
:ON_ERROR Reaction
Parameters
-
:ON_ERROR
Determines reaction to particular errors or messages from script elements -
Reaction
Keyword for reaction to error or message
Format: AE name, script literal or script variable
Allowed values:- RESUME (default)
Script processing continues, allowing return codes to be read - ABEND
Script processing is aborted when an error occurs
- RESUME (default)
Note: You can use :ON_ERROR to define error handling when using the following
-
script functions
- script statements
You can also use :ON_ERROR to include error handling in scripts with arrays that use an invalid index. For more information, see Arrays.
By default, the Automation Engine continues processing scripts that contain these script functions when an error occurs.
Example
The following example specifies that script processing continues in the event of an error. The system checks the capacity of a drive, and retrieves the error number and error message.
:ON_ERROR RESUME
:SET &CHECK# = GET_FILESYSTEM('WIN21', 'Z:\', FILESYSTEM_SPACE_TOTAL)
:SET &ERRNR# = SYS_LAST_ERR_NR
:SET &ERRINS# = SYS_LAST_ERR_INS
:SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)
See also: