MQReadXML function
The MQReadXML function returns XML data from the WebSphere® MQ location that is specified by receive-service. It uses the quality of receive-policy. The MQREADXML function does not remove messages from the queue associated with receive-service.
Syntax
Parameters
- receive-service
- A string containing the logical WebSphere MQ destination from where the message will be received. If specified, receive-service must refer to a service point defined in the DB2MQ.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 WebSphere MQ Queue Manager and Queue. If receive-service is not specified, then the DB2®.DEFAULT.SERVICE will be used. The maximum size of receive-service is 48 bytes.
- receive-policy
- A string containing the MQSeries receive policy used to handle this message. If specified, receive-policy must refer to a policy defined in the DB2MQ.MQPOLICY table. A receive policy defines a set of quality of service options that should be applied to this messaging operation. These options include message priority and message persistence. If receive-policy is not specified, the default DB2.DEFAULT.POLICY is used. The maximum size of receive-policy is 48 bytes.
Results
When a message in the queue is read successfully, MQREADXML returns an XML message. A NULL is returned if no messages are available.
Examples
Example 1: In this example the message is read at the head of the queue that is specified by the default service DB2.DEFAULT.SERVICE. It uses the default policy DB2.DEFAULT.POLICY to read the message.
values DB2MQ.MQREADXML()
The contents of the message are returned as XML. If no messages are available, a NULL is returned.
Example 2: In this example the message is read at the head of the queue that is specified by the service MYSERVICE using the default policy DB2.DEFAULT.POLICY.
values
DBXML.MQREADXML('MYSERVICE')
The contents of the message are returned as XML. If no messages are available a NULL is returned.
Example 3: In this example the message is read at the head of the queue that is specified by the service MYSERVICE using the policy MYPOLICY.
values
DBXML.MQREADXML('MYSERVICE','MYPOLICY')
The contents of the message are returned as XML if successful. If no messages are available, a NULL is returned.