Automating IBM MQ administration using PCF commands

We might decide that it would be beneficial to your installation to automate some administration and monitoring tasks. We can automate administration tasks for both local and remote queue managers using programmable command format (PCF) commands. This section assumes that we have experience of administering IBM MQ objects.


PCF commands

IBM MQ programmable command format (PCF) commands can be used to program administration tasks into an administration program. In this way, from a program we can manipulate queue manager objects (queues, process definitions, namelists, channels, client connection channels, listeners, services, and authentication information objects), and even manipulate the queue managers themselves.

PCF commands cover the same range of functions provided by MQSC commands. We can write a program to issue PCF commands to any queue manager in the network from a single node. In this way, we can both centralize and automate administration tasks.

Each PCF command is a data structure that is embedded in the application data part of an IBM MQ message. Each command is sent to the target queue manager using the MQI function MQPUT in the same way as any other message. Providing the command server is running on the queue manager receiving the message, the command server interprets it as a command message and runs the command. To get the replies, the application issues an MQGET call and the reply data is returned in another data structure. The application can then process the reply and act accordingly.

Note: Unlike MQSC commands, PCF commands and their replies are not in a text format that we can read. Briefly, these are some of the things needed to create a PCF command message:

    Message descriptor
    This is a standard IBM MQ message descriptor, in which:

    • Message type (MsqType) is MQMT_REQUEST.
    • Message format (Format) is MQFMT_ADMIN.

    Application data
    Contains the PCF message including the PCF header, in which:

    • The PCF message type (Type) specifies MQCFT_COMMAND.
    • The command identifier specifies the command, for example, Change Queue (MQCMD_CHANGE_Q).

For a complete description of the PCF data structures and how to implement them, see Introduction to IBM MQ Programmable Command Formats.


PCF object attributes

Object attributes in PCF are not limited to eight characters as they are for MQSC commands. They are shown in this guide in italics. For example, the PCF equivalent of RQMNAME is RemoteQMgrName.


Escape PCFs

Escape PCFs are PCF commands that contain MQSC commands within the message text. We can use PCFs to send commands to a remote queue manager. For more information about escape PCFs, see Escape.

  • Introduction to IBM MQ Programmable Command Formats
    Programmable Command Formats (PCFs) define command and reply messages that can be exchanged between a program and any queue manager (that supports PCFs) in a network. PCFs simplify queue manager administration and other network administration. They can be used to solve the problem of complex administration of distributed networks especially as networks grow in size and complexity.
  • 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).

Parent topic: Administer IBM MQ