Use one of these field-level keywords to identify a message to be displayed on the message line and associated with this field.
A warning message appears at file creation time if either of these keywords is specified on a record with the DSPMOD keyword. At run time, these keywords are ignored when the display mode changes.
Option indicators are valid for these keywords.
ERRMSG('message-text' [response-indicator])
For ERRMSG, the parameters specify the message text and, optionally, a response indicator. The message text is the message to be displayed. (The Help key is not supported. Message help is not displayed when the Help key is pressed.)
If you specify a response indicator, it should be the same as the option indicator used to condition ERRMSG. On the input operation that follows the display of the error message, the i5/OS™ operating system turns off the indicator. If the response and the option indicators are the same, they are both turned off. One exception to this rule is if the response indicator is also specified for another keyword, such as CHANGE, CAnn, or CFnn. In that case, the on/off setting of the response indicator is based on the results of the function provided by the CHANGE or CFnn keyword. When a response indicator is specified, the first 50 characters of the message are also used as indicator text. Separate response indicator text is not valid for the ERRMSG keyword.
ERRMSGID(msgid [library-name/]msg-file [response-indicator] [&msg-data])
For ERRMSGID, the parameters specify:
The response indicator, if specified, should be the same as the option indicator used to condition the ERRMSGID keyword. On the subsequent input operation, after the display of the error message, the i5/OS operating system turns off the indicator. However, if the response indicator is also specified on another keyword, such as CHANGE, CAnn, or CFnn, the on/off setting of the response indicator is based on the results of the function provided by the CHANGE, CAnn, or CFnn keyword.
The msg-data field, if specified, contains the replacement text for the specified message. The field must exist in the record format and the field must be defined as a character field (data type A) with usage P. For more information about how replacement text works, refer to the Send Program Message (CL) command in the Control language topic.
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 keywords:
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 SFLMSG (Subfile Message) and SFLMSGID (Subfile Message Identifier) keywords for display files.
The displaying of a message using ERRMSG and ERRMSGID is similar to the displaying of messages by the i5/OS operating system 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:
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.
The following example shows how to specify 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