You are here: Development Standards > Routines > General Routines > GENERROR

# GENERROR

GENERROR is a general routine that interfaces to GENERROR.PUB for handling program errors, messages and verifications. The GENERROR2 routine is also required. GENERROR and GENERROR2 occupy lines 8400–8499 and should be merged into all interactive programs.

Variable | Description
X9$ | Message to display before waiting for input. X9$ is limited to 76 characters and is cleared before GENERROR.PUB exits.
X8$ | Message to display without waiting for input unless coupled with an X9$ message or O7 value, in which case X8$ serves as a second message line. X8$ cannot exceed 76 characters. Clear it by passing X8$=" " to GENERROR. If X8$ is coupled with a X9$ or O7 value, it is cleared automatically by GENERROR.
O7 | Selects a predefined message or verification prompt. -3 - an error occurred (used by GENERROR only) -2 - an ESCAPE occurred (used by GENLOCK only) -1 - an error occurred (used by GENLOCK only) 0 - no error and no message selected 1 - Go to Menu 2 - Proceed 3 - Delete 4 - Abandon 5 - Invalid Date 6 - Invalid Entry 7 - Record Not Found 8 - ‘xxxxxxxx’ is not on file 10 - Prompts for a Yes/No choice in GUI mode only. May populate other choices besides Yes/No. To do so, place choices in X$ separated by a $0D$ O7 is set to 0 before exiting. Use X8$ to add a second message line. Use X9$ to add a second message line and force the user to press the key for the O7 value (1–4 are the only key-related values and only 1 makes sense). X8$ and X9$ cannot be used with an O7 value.
Y$ | Command to be processed from GENINPUT. A nonblank X8$ or X9$ value or a non-zero O7 value take precedence over a Y$ value. Y$ is set to the appropriate value after a key is pressed before GENERROR.PUB exits.
MX8 | Numeric index for an X8$ message stored in an xxMS (application message) file. Used in lieu of X8$.
MX9 | Numeric index for an X9$ message stored in an xxMS (application message) file. Used in lieu of X9$.
X1$ | Mask that caused a mask format error
F$ | File name that caused a file error
PROGID$ | Program to call for the File Maintenance key
FILE[ALL] | Standard file array
YDISABLE$ | String of Y$ values that should be ignored. Note that only ESC sequence commands can be disabled (that is, Esc+X for Abandon, but not Ctrl+K for Up).
PGM(-2) | Name of program calling GENERROR.PUB
X$ | Used in certain O7 values. Mainly will be used in O7=8 or O7=10 for GUI
X4 | Length of input from GENINPUT.PUB
OSGUI$ | GUI template (see GENGURES.PUB on page 3-50 for more detail)

Exit Points | Explanation
RETURN | GENERROR normally returns.
RETRY | A RETRY is attempted if Y$ is "R".
GOTO 8470 | Y$ = "S" for a Start Over key press.
GOTO 8480 | Y$ = "X" for an Abandon key press (and verified if necessary).
GOTO 9990 | Y$ = "M" for an Exit key press (and verified if necessary).

Part of GENERROR is designed to handle BASIC errors. To take advantage of this feature, place a SETERR GENERROR statement at line 1 of a program. GENERROR can trap and interpret errors. It displays appropriate error messages and determines whether the user should be allowed to return to the program, retry the operation that failed, or be forced to exit to the menu.

The remainder of GENERROR is designed to display messages based on the values of X8$ or MX8, X9$ or MX9, O7 and/or Y$, and wait for the user to acknowledge the message (with the exception of X8$).

In both cases GENERROR exits based on the value returned in Y$ from GENERROR.PUB.