GET_MSG_TXT
Script Function: Retrieves the message text of the last error.
Syntax
GET_MSG_TXT (Number [,Insert])
Syntax |
Description/Format |
---|---|
Number |
Error number. The script function SYS_LAST_ERR_NR also supplies the error number. |
Insert |
Variable part of the error message (text). The script function SYS_LAST_ERR_INS also supplies the variable part of the error number. |
Return codes |
---|
Message text of the last error. |
For some script elements, you can use the :ON_ERROR script statement to have script processing continued even if an error occurs. Use the GET_MSG_TEXT script function to retrieve the error message in such a case. For more information, see Error Handling in Scripts.
The error number Number and the variable part Insert are the basis for retrieving the message text. You can previously retrieve the error number by using SYS_LAST_ERR_NR and the variable part of the error message by using SYS_LAST_ERR_INS. The script function GET_MSG_TXT uses this information and the error texts in order to compose the complete AE error message.
The parameter Insert is not required if the message text does not include variable parts such as in status texts whose numbers can be read by using GET_STATISTIC_DETAIL.
Example
The following example checks the memory capacity of a non-existing drive which results in an error. The error number and the variable part of the error message are read. This information is used to retrieve the complete AE error message which is then sent to a user as a message.
: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#)
:SEND_MSG
BU,BU,&MESSAGE#
The second example retrieves the text that informs about a task's status.
:SET &STATUS# = GET_STATISTIC_DETAIL(&RUNNR#, STATUS)
:SET &TEXT# = GET_MSG_TXT(&STATUS#)
:PRINT &TEXT#
The output could be as shown below:
ENDED_CANCEL - manually canceled.
See also: