MESSAGE_QUEUE_INFO view
The MESSAGE_QUEUE_INFO view returns one row for each message in a message queue. It returns information similar to what is returned by the Display Messages (DSPMSG) CL command and the Receive Nonprogram Message (QMHRCVM) API.
This view does not change the contents of the message queue. The message is kept in the message queue without changing its new or old designation. The view does not utilize the wait time parameter as described in the QMHRCVM API. A wait time of 0 is used.
Authorization: The user must have *USE authority to the message queue and *EXECUTE authority to the message queue library.
The following table describes the columns in the view. The system name is MSGQ_INFO. The schema is QSYS2.
Column Name | System Column Name | Data Type | Description |
---|---|---|---|
MESSAGE_QUEUE_LIBRARY | MSGQ_LIB | VARCHAR(10) | The name of the library containing the message queue. |
MESSAGE_QUEUE_NAME | MSGQ_NAME | VARCHAR(10) | The name of the message queue containing the message. |
MESSAGE_ID | MSGID | VARCHAR(7) Nullable
|
The message ID for this message. Contains the null value if this is an impromptu message or MESSAGE_TYPE is REPLY. |
MESSAGE_TYPE | MSG_TYPE | VARCHAR(13) | Type of message. Values are:
|
MESSAGE_SUBTYPE | MSG_SUBTYP | VARCHAR(22) Nullable
|
Subtype of message. The values returned for REPLY messages:
The value returned for some REQUEST messages:
Contains the null value for other message types. |
MESSAGE_TEXT | MSG_TEXT | VARGRAPHIC(1024) CCSID 1200 Nullable
|
The first level text of the message including tokens, or the
impromptu message text. Contains the null value if the message file could not be accessed. |
SEVERITY | SEVERITY | SMALLINT | The severity assigned to the message. |
MESSAGE_TIMESTAMP | MSG_TIME | TIMESTAMP | The timestamp when the message was sent. |
MESSAGE_KEY | MSG_KEY | BINARY(4) | The key assigned to the message. The key is assigned by the command or API that sends the message. For details, see Message Types and Message Keys in the Qmhrcvm API |
ASSOCIATED_MESSAGE_KEY | ASSOC_KEY | BINARY(4) Nullable
|
For MESSAGE_TYPE of REPLY, contains
the associated inquiry or notify message key. Contains the null value for other message types. |
FROM_USER | FROM_USER | VARCHAR(10) | The current user of the thread when the message was sent. |
FROM_JOB | FROM_JOB | VARCHAR(28) | The qualified job name of the job that sent the message. |
FROM_PROGRAM | FROM_PGM | VARCHAR(10) | The program that sent the message. |
MESSAGE_FILE_LIBRARY | MSGF_LIB | VARCHAR(10) Nullable
|
The name of the library containing the message file. Contains the null value if MESSAGE_ID is null or if the message file could not be accessed. |
MESSAGE_FILE_NAME | MSGF_NAME | VARCHAR(10) Nullable
|
The message file containing the
message. Contains the null value if MESSAGE_ID is null. |
MESSAGE_TOKENS | MSG_TOKENS | VARCHAR(4096) FOR BIT DATA Nullable
|
The message token string. If the
value is longer than 4096 characters, it will be truncated with no
warning. Contains the null value if there are no tokens. |
MESSAGE_SECOND_LEVEL_TEXT | MSG_TEXT2 | VARGRAPHIC(4096) CCSID 1200 Nullable
|
The second level text of the message
including tokens. Contains the null value if MESSAGE_ID is null or if the message has no second level text or if the message file could not be accessed. |
Example
- Examine all inquiry messages and their responses.
SELECT a.message_timestamp, a.message_text, a.from_user, b.message_timestamp, b.message_text, b.from_user FROM qsys2.message_queue_info a INNER JOIN qsys2.message_queue_info b ON a.message_key = b.associated_message_key WHERE a.message_type = 'INQUIRY' AND b.message_type = 'REPLY' ORDER BY b.message_timestamp DESC;