Script Function: Retrieves the message text of the last error.
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. |
In some script elements, you can use :ON_ERROR in order to have script processing continued even if an error occurs. The error message can be retrieved by using the script function GET_MSG_TXT in such a case.
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.
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:
Script element | Description |
---|---|
Retrieves the type of a message number. |
|
Supplies the variable message part of the last error. |
|
Returns the number of the last error. |
Script Elements - Error Handling and Messages
Sample Collection:
Retrieving Error Message and Number
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function