Figure 164 shows how to specify the ERRMSG and ERRMSGID keywords.
Figure 164. Specifying the ERRMSG and ERRMSGID Keywords
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 00010A R CUSMST 00020A : 00030A : 00040A : 00050A QTYORD 10A I 5 3 00060A 61 ERRMSG('No stock available' 61) 00070A 62 ERRMSG('Partial stock available' + 00080A 62) 00090A 63 ERRMSGID(MSG2000 CONSOLEMSG 63 + 00100A &RPLTXT); 00110A RPLTXT 78A P A
You can specify ERRMSG and ERRMSGID more than once for a single field. During program processing, use option indicators to select a particular message to be displayed.
Only one message can be displayed at one time even if messages are in effect for several fields on the same output operation. The field whose message is displayed is the first field for which the program selected a message.
If several keywords are in effect for one field on an output operation, the message to be displayed is the first of the following:
A message field is displayed only if no error message keywords are also to be displayed.
For a list of priorities including the SFLMSG and SFLMSGID keywords, see Priority among Selected Keywords for Display Files.
The displaying of a message using ERRMSG and ERRMSGID is similar to the displaying of messages by the OS/400 program when field validation errors are detected.
When a message is displayed because of either the ERRMSG or the ERRMSGID keyword, all fields on the display are kept, including the field the message is associated with. Except for option indicators, data in the output buffer is ignored (that is, any new data from the program is not sent to the display).
The function keys valid following display of a message are:
When the message is displayed, the following conditions occur:
If a field in error has both the underline (UL) display attribute and the highlight (HI) attribute or the underline (UL) attribute and COLOR(BLU, WHT, or YLW) specified, its image is not reversed.
Fields are displayed with their images reversed because of system-detected typing errors or because of the ERRMSG or the ERRMSGID keyword. Generally, the OS/400 program restores the image on the next I/O operation to the display, usually the next request from your program. The restoration is done before the requested function is performed. The following are exceptions where requests from your program do not cause the OS/400 program to restore reversed image fields:
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.