SYS_LAST_ERR_INS

Use the SYS_LAST_ERR_INS script function to retrieve the variable message part of the last error.

Tip: You can include processing instructions in scripts to define what happens when an error occurs. For more information, see :ON_ERROR. You can then use SYS_LAST_ERR_INS to retrieve the variable part of the error message for further processing.

Syntax

SYS_LAST_ERR_INS ()

Return Codes

  • The script function returns the variable message part of the last error.
  • If no error has occurred, the script function returns a blank

Most error messages do not only consist of a predetermined text. Parts of the message refer to object names or script lines, for example. These variable parts of error messages are put in quotation marks.

Example of an error message:

U0020645 - Runtime error in object '&01', line '&02'.: There is no object '&04'.

The variable parts are replaced by values when the above error message is output:

U0020645 - Runtime error in object 'MOVE_OBJECT', line '0003'. There is no object  'MM.CLOSING.2005'.

Example

The following example checks the memory of a hard drive. An error occurs if this hard drive is not available or cannot be accessed. The corresponding error number and variable message parts are read, and the entire AE error message is retrieved and sent to a user.

:SET &CHECK#  = GET_FILESYSTEM("WIN21G", "Z:\", FILESYSTEM_SPACE_TOTAL)
:
SET &ERRINS# = SYS_LAST_ERR_INS()
:
IF &ERRINS# NE ""
:   
SET &ERRNR#   = SYS_LAST_ERR_NR()
:   
SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)
:   
SEND_MSG BU,BU,&MESSAGE# 
:
ENDIF

See also: