Start of change

MQREADALL

The MQREADALL function returns a table that contains the messages and message metadata from a specified MQSeries® location with a VARCHAR column without removing the messages from the queue.

Read syntax diagramSkip visual syntax diagram
>>-MQREADALL--(--+----------------------------------------+--+---------------------+--)-><
                 '-receive-service--+-------------------+-'  |                 (1) |      
                                    '-,--service-policy-'    '-+---+--num-rows-----'      
                                                               '-,-'                      

Notes:
  1. The comma is required before num-rows when any of the preceding arguments to the function are specified.
The MQREADALL function returns a table containing the messages and message metadata from the MQSeries location that is specified by receive-service, using the quality-of-service policy that is defined in service-policy. Performing this operation does not remove the messages from the queue that is associated with receive-service.
receive-service
An expression that returns a value that is a built-in character string or graphic string data type that is not a LOB. The value of the expression must not be an empty string or a string with trailing blanks. The expression must have an actual length that is no greater than 48 bytes. The value of the expression must refer to a service point that is defined in the SYSIBM.MQSERVICE table. A service point is a logical end-point from where a message is sent or received. Service point definitions include the name of the MQSeries queue manager and queue. For more information about MQSeries Application Messaging, see SQL Programming.

If receive-service is not specified or the null value, DB2®.DEFAULT.SERVICE is used.

service-policy
An expression that returns a value that is a built-in character string or graphic string data type that is not a LOB. The value of the expression must not be an empty string or a string with trailing blanks. The expression must have an actual length that is no greater than 48 bytes. The value of the expression must refer to a service policy that is defined in the SYSIBM.MQPOLICY table. A service policy specifies a set of quality-of-service options that are to be applied to this messaging operation. These options include message priority and message persistence. For more information about MQSeries Application Messaging, see SQL Programming.

If service-policy is not specified or the null value, DB2.DEFAULT.POLICY is used.

num-rows
An expression that returns a value that is a SMALLINT or INTEGER data type whose value is a positive integer or zero. The value of the expression specifies the maximum number of messages to return.

If num-rows is not specified or the value of expression is zero, all available messages are returned.

The result of the function is a table with the format shown in the following table. All the columns are nullable.
Table 1. Format of the resulting table for MQREADALL
Column name Data type Contains
MSG VARCHAR(32000) The contents of the MQSeries message
CORRELID VARCHAR(24) The correlation ID that is used to relate messages
TOPIC VARCHAR(40) Reserved
QNAME VARCHAR(48) The name of the queue from which the message was received
MSGID VARCHAR(24) The unique, MQSeries-assigned identifier for the message
MSGFORMAT VARCHAR(8) The format of the message, as defined by MQSeries

The CCSID of the result columns, except for CORRELID and MSGID, is the default CCSID at the current server.

Notes

Prerequisites: In order to use the MQSeries functions, IBM® MQSeries for IBM i must be installed, configured, and operational.

Example

End of change