CHKMSGID (Check Message Identifier) keyword for display files

You use this field-level keyword to identify an error message that is issued when a validity check error is detected.

If you do not specify the CHKMSGID keyword, the system supplies a message. You specify the associated validity checking rules on a CHECK(M10), CHECK(M11), CHECK(VN), CHECK(VNE), CMP, COMP, RANGE, or VALUES keyword.

The format of the keyword is:

CHKMSGID(message-id [library/]message-file [&message-data-field])

The message-ID parameter specifies the message description that contains the text to be displayed on the message line.

The message-file and library parameters identify the message file containing the message descriptions. The library name is optional. If it is not specified, the library list (*LIBL) that is in effect at run time is used to search for the message file.

The message-data-field parameter specifies the name of the field that contains the message replacement text to be displayed on the message line. The format of the message-data-field parameter is &field-name where field-name is the name of the field containing the message replacement text. The field name must exist in the record format, and the field must be defined as a character field (data type A) with usage P.

CHKMSGID is allowed only on fields which also contain a CHECK(M10), CHECK(M11), CHECK(VN), CHECK(VNE), CMP, COMP, RANGE, or VALUES keyword. The field must be input-capable (usage B or I).

Option indicators are not valid for this keyword.

Example

The following example shows how to specify the CHKMSGID keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      MSGLOC(20)
00020A          R RECORD1
00030A            FIELD1        10A  B  4  2CHECK(VN) CHKMSGID(USR1234 +
00040A                                      QGPL/USRMSGS &MSGFLD1);
00050A            MSGFLD1       12A  P
00060A            FIELD2         1A  I  4 20VALUES('A' 'B' 'I')
00070A                                      CHKMSGID(XYZ9999 APPLMSGS)
00080A            FIELD3         3S OB  4 25RANGE(023 199)
     A

When RECORD1 is read from the display screen:

  • If FIELD1 does not contain a valid name, message USR1234 from the message file USRMSGS in library QGPL with the replacement text specified in MSGFLD1 is displayed on line 20.
  • If the data entered into FIELD2 is not the letter A, B, or I, message XYZ9999 from *LIBL/APPLMSGS is displayed on line 20.
  • If the data entered into FIELD3 is less than 023 or greater than 199, the system-supplied message CPF5224 (value for the field is not in a valid range) is displayed on line 20 because the CHKMSGID keyword is not specified.