err_quit() takes an integer expression as its argument and displays on the error line the text of an SQL or 4GL error message, corresponding to the error code specified by its negative integer argument, and terminates the program.
The argument of err_quit() specifies an error message number, which must be less than zero. It is typically the value of the global status variable, which is reset by both SQL and 4GL errors. For SQL errors only, you can examine the global SQLCA.SQLCODE record.
err_quit() is identical to err_print(), except that err_quit() terminates execution once the message is printed. err_quit() is primarily useful when you are developing a 4GL program. The message that it returns is probably not helpful to the user of your application.
If an error occurs, these statements display the error message on the Error line, and terminate program execution:
MAIN
DEFINE err INTEGER
OPEN WINDOW w1 WITH FORM "err_quit"
INPUT BY NAME err
ON ACTION "ACCEPT"
CALL err_quit(fgl_dialog_getbuffer())
END INPUT
CALL err_quit(err)
END MAIN
DATABASE FORMONLY
SCREEN
{
Enter error number(less than zero value): [err ]
}
ATTRIBUTES
err=FORMONLY.err TYPE INTEGER,
DEFAULT = -1110;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.err
)
DELIMITERS "[]"
If you specify the WHENEVER ANY ERROR CONTINUE compiler directive (or equivalently, the anyerr command-line flag), status is reset after certain additional 4GL statements.