The ERRMSG file provides a standard set of system messages for use by mvBase system processors as well as application programs. An item in this file contains a series of instructions that are interpreted by the ERRMSG processor. The format of ERRMSG items are discussed in the next section.
A simple example of an item in the ERRMSG file is shown in the following screen in two different formats. The first format is a listing produced by the CT command. The second format is a listing produced by the PRINT-ERR command.
>CT ERRMSG 414 414 001 L 002 E ILLEGAL OR MISSING MODIFIER USED IN DEFINING THE FILE AREA(S).
>PRINT-ERR ERRMSG 414
[414] ILLEGAL OR MISSING MODIFIER USED IN DEFINING THE FILE AREA(S). |
The PRINT-ERR command can be used to invoke the ERRMSG processor on an item in any file.
Many of these messages alert the user to an error condition, but many also inform the user about the progress or the completion of an operation. A good example is item [289] in the ERRMSG file. It is used by the TERM command to present a formatted display of terminal and printer settings.
The STOP and ABORT statements in mvBASIC can be used to invoke the error message processor and pass parameters to it.
Format of ERRMSG Items
An item in the ERRMSG file contains instructions that direct the actions of the ERRMSG interpreter. ERRMSG items work similarly to Procs: a message is built in an output buffer and then the contents of the output buffer are displayed on the screen. The message can be formed from the list of parameters passed to the ERRMSG processor, from literal strings, or from system variables for date and time.
By convention, many items in the ERRMSG file use numeric item-IDs. Those starting with B are for mvBASIC. When creating new items in this file, you should be careful not to overwrite existing items used by the system. You might want to use a standard prefix as part of the item-IDs so that the messages specific to an application can be easily identified. The first character on each line describes a specific action.
A |
Inserts the next parameter in the list of parameters passed to the ERRMSG processor. |
A(n) |
Inserts next parameter in a left-justified field of width n. |
D |
Puts the date in the output buffer. |
E |
Output ID of the error message. It can be used in place of H or on a line by itself. Typically found in Attribute 1. |
H |
Places the string that follows in the output buffer. |
H+ |
Suppresses final carriage return or line feed when specified on the last line of the item. |
L |
Inserts a carriage return or line feed into output buffer. If (n) is specified, the message is followed by n carriage returns. |
R(n) |
Inserts the next parameter in a right-justified field of width n. |
S(n) |
Sets the pointer in the output buffer to position n. |
T |
Puts the current time in the output buffer. |
X |
Skips a parameter in the parameter list. |
The following example shows several lines of an mvBASIC program. The OPEN statement specifies a STOP condition that is executed when the file cannot be found. The STOP statement specifies two parameters: the item-ID of an item in the ERRMSG file and the string to be passed. In the following example, the string is the name of a file.
FILE = "CUSTOMER" OPEN "",FILE ELSE STOP 201, FILE |
It invokes the ERRMSG processor on item 201, a standard error message. This item is shown below:
201 001 E ' 002 A 003 H' IS NOT A FILE NAME |
Lines 1 and 3 output literal text. Line 2 retrieves the name of the file, which was specified as the parameter following the message number. When this error message was invoked by the program, the user would see:
[201] 'CUSTOMER' IS NOT A FILE NAME |
When multiple parameters are passed from mvBASIC to ERRMSG processor, parameters are separated by attribute marks.
STOP "MYMSG", "PARAMA": CHAR(254): "PARAMB" |
Logon Messages
Several messages seen by the user are items in the ERRMSG or SYSTEM Dictionary. These are specified in the format of ERRMSG items. The Logon Please message is found in SYSTEM.
ERRMSG items [335] and [336] contain the connect time messages that are displayed when a user logs on or off the system. [335] also gives the date and release number of the operating system.
@TCL |
An @TCL Proc in the ERRMSG file can be created to assume control over a user’s process when control would otherwise pass to the TCL processor. In order for the @TCL Proc to receive control, the user’s Account Definition item must specify a T in Attribute 9. If the user’s Master Dictionary contains a Proc named account-name@TCL, that Proc will be executed instead of @TCL in ERRMSG.
See Also