Home

 

Filtering and querying data items

 

When using the MQAI to inquire about the attributes of WebSphere MQ objects, we can control the data that is returned to your program in two ways.

  1. We can filter the data that is returned using the mqAddInteger and mqAddString calls. This approach lets you specify a Selector and ItemValue pair, for example:
    mqAddInteger(inputbag, MQIA_Q_TYPE, MQQT_LOCAL)
    This example specifies that the queue type (Selector) must be local (ItemValue) and this specification must match the attributes of the object (in this case, a queue) about which you are inquiring.

    Other attributes that can be filtered correspond to the PCF Inquire* commands that can be found in part 1 of this book. For example, to inquire about the attributes of a channel, see the Inquire Channel command in this book. The “Required parameters” and “Optional parameters” of the Inquire Channel command identify the selectors that we can use for filtering.

  2. We can query particular attributes of an object using the mqAddInquiry call. This specifies the selector in which you are interested. If you do not specify the selector, all attributes of the object are returned.

Here is an example of filtering and querying the attributes of a queue:

/* Request information about all queues */
mqAddString(adminbag, MQCA_Q_NAME, “*”)
 
/* Filter attributes so that local queues only are returned */
mqAddInteger(adminbag, MQIA_Q_TYPE, MQQT_LOCAL)
 
/* Query the names and current depths of the local queues */
mqAddInquiry(adminbag, MQCA_Q_NAME)
mqAddInquiry(adminbag, MQIA_CURRENT_Q_DEPTH)
 
/* Send inquiry to the command server and wait for reply */
mqExecute(MQCMD_INQUIRE_Q, …)

For more examples of filtering and querying data items, see Examples of using the MQAI.

 

Parent topic:

Adding an inquiry command to a bag


pc15580_


 

Home