Use the MQAI to simplify the use of PCFs
The IBM MQ Administration Interface (MQAI) is a programming interface to IBM MQ that is available on AIX , HP-UX, IBM i, Linux , Solaris, and Windows. It performs administration tasks on an IBM MQ queue manager using data bags to handle properties (or parameters) of objects in a way that is easier than using Programmable Command Formats (PCFs).
The MQAI performs administration tasks on a queue manager through the use of data bags. Data bags allow you to handle properties (or parameters) of objects in a way that is easier than using PCFs.
The advantages of using the MQAI are as follows:
- Simplify the use of PCF messages
- The MQAI is an easier way to administer IBM MQ. If we use the MQAI, we do not have to write your own PCF messages. This avoids the problems associated with complex data structures.
To pass parameters in programs written using MQI calls, the PCF message must contain the command, and details of the string or integer data. To create this configuration manually, you have to add several statements in your program for every structure, and we have to allocate memory space. This task can be long and laborious.
Programs written using the MQAI pass parameters into the appropriate data bag, and you need only one statement for each structure. The use of the MQAI data bags removes the need for you to handle arrays and allocate storage, and provides some degree of isolation from the details of the PCF.
- Handle error conditions more easily
- It is difficult to get return codes back from PCF commands. The MQAI makes it easier for the program to handle error conditions.
- Exchange data between applications
- The application data is sent in PCF format and packed and unpacked by the MQAI. If your message data consists of integers and character strings, we can use the MQAI to take advantage of IBM MQ built-in data conversion for PCF data. This avoids the need to write data-conversion exits.
After we have created and populated your data bag, we can send an administration command message to the command server of a queue manager, using the mqExecute call. This call waits for any response messages. The mqExecute call handles the exchange with the command server, and returns responses in a response bag.
Examples of using the MQAI
The list shown gives some example programs that demonstrate the use of MQAI. The samples perform the following tasks:
- Create a local queue. Sample C program for creating a local queue (amqsaicq.c)
- Display events on the screen using a simple event monitor. Sample C program for displaying events using an event monitor (amqsaiem.c)
- Print a list of all local queues and their current depths. Sample C program for inquiring about queues and printing information (amqsailq.c)
- Print a list of all channels and their types. Sample C program for inquiring channel objects (amqsaicl.c)
Building your MQAI application
To build our application using the MQAI, you link to the same libraries as we do for IBM MQ. For information on how to build your IBM MQ applications, see Building a procedural application.
Hints and tips for configuring IBM MQ using MQAI
The MQAI uses PCF messages to send administration commands to the command server rather than dealing directly with the command server itself. Tips for configuring IBM MQ using the MQAI can be found in Hints and tips for using MQAI to configure IBM MQ.