The Browser sample program

The Browser sample program reads and writes both the message descriptor and the message content fields of all the messages on a queue.

The sample program is written as a utility, not just to demonstrate a technique. See Features demonstrated in the sample programs for the names of these programs.

This program takes these parameters:
  1. The name of the source queue
  2. The name of the queue manager
  3. An optional parameter for properties.
The first two input parameters for this program are mandatory. For example, start the program in one of the following ways:
  • amqsbcg myqueue qmanagername
  • amqsbcgc myqueue qmanagername
where myqueue is the name of the queue on which the messages are going to be browsed, and qmanagername is the queue manager that owns myqueue.
It reads each message from the queue and writes the following to stdout:
  • Formatted message descriptor fields
  • Message data (dumped in hex and, where possible, character format)
Permissible values for the property parameter are:
Value Behavior
0 Default behaviour, as it was for V6. The properties that get delivered to the application depend on the PropertyControl queue attribute that the message is retrieved from.
1 A message handle is created and used with the MQGET. Properties of the message, except those contained in the message descriptor (or extension) are displayed in a similar fashion to the message descriptor. For example:  
****Message properties****
   <property name> : <property value>    
Or if no properties are available:  
****Message properties****
   None
Numeric values are displayed using printf, string values are surrounding in single quotation marks, and byte strings are surrounded with X and single quotation marks, as for the message descriptor.
2 MQGMO_NO_PROPERTIES is specified, so that only message descriptor properties will be returned.
3 MQGMO_PROPERTIES_FORCE_MQRFH2 is specified, so that all properties are returned in the message data.
4 MQGMO_PROPERTIES_COMPATIBILITY is specified, so that all properties can be returned depending on whether a version 6 property is included, otherwise the properties are discarded.

The program is restricted to printing the first 65535 characters of the message, and fails with the reason truncated msg if a longer message is read.

See the Administering for an example of the output from this utility.