ERTXT

Return an error message

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall ERTXT(error, message, [len][, position])

Arguments

error

The number or mnemonic of the error for which you’re requesting an error message. (n)

message

The variable that will be loaded with the error message, stored left-justified over blanks. (a)

len

(optional) The length of the message text. (n)

position

(optional) Returned with the position of the message text, after the facility, severity, and mnemonic. (n)

Discussion

The ERTXT subroutine enables your program to report trappable errors accurately to the person running the program. It returns a descriptive error message that corresponds to the specified error code.

The message can have up to 45 characters. If the variable is too short to hold the message, only the leftmost portion of the message is stored.

If the specified error number is undefined, the ERTXT subroutine returns the error text from $ERR_UNDFERR (“Undefined error”).

ERTXT is functionally identical to DBL$ERRTXT.

On OpenVMS, if system option #35 is set, the returned message includes the facility, severity, and mnemonic, and the position argument is loaded with the starting position of the message text. Otherwise, if option #35 is not set, the text does not include the facility, severity, or mnemonic, and the position argument has a value of 1.

Examples

The following subroutine displays the most recent Synergy DBL error number, text, and line number.

subroutine proc_error
.define TTCHN   ,1
record
    msg         ,a45
proc
    xcall ertxt(%error, msg)
    writes(TTCHN, "Error#" + %string(%error) + ": " + msg +
  &        " at line " + %string(%erlin))
    return
endsubroutine