The Set and Inquire message property sample

The message property sample programs demonstrate the addition of user-defined properties to a message handle, and the inquisition of the properties associated with that message.

The applications use these MQI calls:
  • MQCONN
  • MQOPEN
  • MQPUT
  • MQGET
  • MQCLOSE
  • MQDISC
  • MQCRTMH
  • MQDLTMH
  • MQINQMP
  • MQSETMP

The programs are delivered in the C language. The applications run in the batch environment. See Other samples for the batch applications.

The CSQ4BCM1 program is used to inquire the properties of a message handle from a message queue, and it is an example of the use of the MQINQMP API call. The sample gets one message from a queue and then prints all the message handle properties.

The CSQ4BCM2 program is used to set the properties of a message handle on a message queue, and it is an example of the use of the MQSETMP API call. The sample creates a message handle and puts it into the MsgHandle field of the MQGMO structure. It then puts the message to a queue.

Other examples of inquiring and printing message properties are included in the CSQ4BCG1 and CSQ4BCP4 sample programs.

This topic also provides information on running the Set and Inquire message property samples under the following headings:

Running the CSQ4BCM1 sample

This program takes up to four parameters:
  1. The name of the target queue (required).
  2. The name of the queue manager (optional).
  3. Open options (optional).
  4. Close options (optional).

Running the CSQ4BCM2 sample

This program takes up to six parameters:
  1. The name of the target queue (required).
  2. The name of the queue manager (optional).
  3. Open options (optional).
  4. Close options (optional).
  5. The name of the target queue manager (optional).
  6. The name of the dynamic queue (optional).

The property names, values, and message content are provided through the standard input ( SYSIN DD ). There is a sample JCL to run the program, it resides in CSQ4BCMP.