: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:
- ACTIVATE_UC_OBJECT
- AUTOFORECAST
- CANCEL_UC_OBJECT
- CHANGE_LOGGING
- CREATE_OBJECT
- EXPORT
- FIRST_OF_PERIOD
- GET_FILESYSTEM
- GET_FILESYSTEM
- GET_STATISTIC_DETAIL
- IMPORT
- LAST_OF_PERIOD
- MOVE_OBJECT
- PREP_PROCESS_FILENAME
- REMOVE_OBJECT
- RESTART_UC_OBJECT
- SEND_MAIL
- :SEND_MSG
- SYS_SERVER_ALIVE
- SYS_USER_ALIVE
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: