Here are some example uses of the mqExecute call.
The example shown in figure Figure 10 creates a local queue (with a maximum message length of 100 bytes) on a queue manager:
/* Create a bag for the data you want in your PCF message */ mqCreateBag(MQCBO_ADMIN_BAG, &hbagRequest) /* Create a bag to be filled with the response from the command server */ mqCreateBag(MQCBO_ADMIN_BAG, &hbagResponse) /* Create a queue */ /* Supply queue name */ mqAddString(hbagRequest, MQCA_Q_NAME, "QBERT") /* Supply queue type */ mqAddString(hbagRequest, MQIA_Q_TYPE, MQQT_LOCAL) /* Maximum message length is an optional parameter */ mqAddString(hbagRequest, MQIA_MAX_MSG_LENGTH, 100) /* Ask the command server to create the queue */ mqExecute(MQCMD_CREATE_Q, hbagRequest, hbagResponse) /* Tidy up memory allocated */ mqDeleteBag(hbagRequest) mqDeleteBag(hbagResponse)
The example shown in figure Figure 11 inquires about all attributes of a particular queue. The mqAddInquiry call identifies all WebSphere MQ object attributes of a queue to be returned by the Inquire parameter on mqExecute.
/* Create a bag for the data you want in your PCF message */ mqCreateBag(MQCBO_ADMIN_BAG, &hbagRequest) /* Create a bag to be filled with the response from the command server */ mqCreateBag(MQCBO_ADMIN_BAG, &hbagResponse) /* Inquire about a queue by supplying its name */ /* (other parameters are optional) */ mqAddString(hbagRequest, MQCA_Q_NAME, "QBERT") /* Request the command server to inquire about the queue */ mqExecute(MQCMD_INQUIRE_Q, hbagRequest, hbagResponse) /* If it worked, the attributes of the queue are returned */ /* in a system bag within the response bag */ mqInquireBag(hbagResponse, MQHA_BAG_HANDLE, 0, &hbagAttributes) /* Inquire the name of the queue and its current depth */ mqInquireString(hbagAttributes, MQCA_Q_NAME, &stringAttribute) mqInquireString(hbagAttributes, MQIA_CURRENT_Q_DEPTH, &integerAttribute) /* Tidy up memory allocated */ mqDeleteBag(hbagRequest) mqDeleteBag(hbagResponse)
Using mqExecute is the simplest way of administering WebSphere MQ, but lower-level calls, mqBagToBuffer and mqBufferToBag, can be used. For more information about the use of these calls, see Exchanging data between applications.
For sample programs, see Examples of using the MQAI.
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
csqzac04314 |