err_get() takes an integer expression as its argument and returns a character string containing the text of the 4GL or SQL error message for the specified argument.
err_get() is most useful when you are developing a program. The message that it returns is probably not helpful to the user of your 4GL application. The argument of err_get() is typically the value of the status variable, which is affected by both SQL and 4GL errors, or else a member of the global SQLCA.SQLCODE record.
In this example user is prompted to enter an error code and presses OK.
The default error code value in the example is -1110.
This error text is displayed in the winmessage error window if found.
MAIN
DEFINE
current_error_status integer,
str STRING
CALL fgl_winprompt(10, 10, "Enter error number:", "-1110", 5, 2) returning current_error_status
LET str = "Error ", current_error_status
CALL fgl_winmessage(str clipped, err_get(current_error_status), "error")
END MAIN
The value of status can be assigned by a wide range of different statement variables. In order to avoid the status being changed unexpectedly it is always advisable to copy it as soon as possible so that the value you want to maintain does not get changed.