SQL iQuery Script Built-in Functions

Retrieve Message ID Text from Message File


The MSGID() built-in function returns the content of a message ID stored in a message file. Use this to retrieve the first or second-level message text..


The MSGID built-in function returns the first or second level text for a given message ID after inserting the optional message data.


  1. The 7-character message ID
  2. The message file name. If qualified, it should be the classic CL style qualified name library/file. If now message file is specified QCPFMSG is used.
  3. Optional message data to be used as the substitution text for the message.
  4. Optional message level to return: 1=First level message text (default), 2=Second level text

You can use message IDs in message files to store information that is communicated with your users, or to store values used in iQuery Scripts or SQL statement run in an iQuery Script.

eval &text = msgid(qwx2221);
#msg QWX2221 = &text

The output written to the joblog is:

QWX2221 = * * * M A X I M U M R O W S R E A C H E D * * *