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, IBM i, Linux, 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 you 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 we 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 you 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 following sample programs demonstrate the use of MQAI to perform the various tasks:
- amqsaicq.c: create a local queue.
- amqsaiem.c: display events on the screen using a simple event monitor.
- amqsailq.c: print a list of all local queues and their current depths.
- amqsaicl.c: print a list of all channels and their types.
Building your MQAI application
To build the application using the MQAI, you link to the same libraries as you do for IBM MQ. For information on how to build the 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.
- Hints and tips for using MQAI to configure IBM MQ
The IBM MQ Administration Interface (MQAI) uses PCF messages to send administration commands to the command server rather than dealing directly with the command server itself. Here are some tips for configuring IBM MQ using the MQAI.- Advanced MQAI topics
Information on indexing, data conversion and use of message descriptor- Sample C program for creating a local queue (amqsaicq.c)
The sample C program amqsaicq.c creates a local queue using the MQAI.- Sample C program for displaying events using an event monitor (amqsaiem.c)
The sample C program amqsaiem.c demonstrates a basic event monitor using the MQAI.- Sample C program for inquiring about channel objects (amqsaicl.c)
The sample C program amqsaicl.c inquires channel objects using the MQAI.- Sample C program for inquiring about queues and printing information (amqsailq.c)
The sample C program amqsailq.c inquires the current depth of the local queues using the MQAI.- Data bags and the MQAI
A data bag is a means of handling properties or parameters of objects using the IBM MQ Administration Interface (MQAI).- Send administration commands to the qm command server using the mqExecute call
When a data bag has been created and populated, an administrative command message can be sent to the command server of a queue manager using the mqExecute call. This handles the exchange with the command server and returns responses in a bag.Parent topic: Automating IBM MQ administration using PCF commands
Related information