IBM Support

MQ V7: How to view the message properties and, or RFH2 header from a message

White Papers


Abstract

It is possible to use WebSphere MQ Explorer V7 and the C sample "amqsbcg" to display the RFH2 header for JMS messages and to display message properties created by non-JMS applications.

This document shows the different output that can be obtained with the different choices from the Explorer and the sample amqsbcg.

Content

Related WebSphere Support Technical Exchange (WSTE) webcast:
Browsing Message Fields, Properties and Contents in WebSphere MQ

Abstract
This WebSphere Support Technical Exchange presents the different mechanisms to browse messages in WebSphere MQ. It discusses how to view the message fields, message properties, the contents of the message and reason codes from dead letter queue using sample executables and the MQ Explorer.
The first and second parts of the presentation focus on methods that work in both V6 and V7. These parts are targeted for beginners.
The third part, showing only the methods that work with V7, is targeted for intermediate users.


It is possible to use the MQ Explorer V7 and the C sample "amqsbcg" to display the RFH2 header for JMS messages and to display message properties created by non-JMS applications.

This document shows the different output that can be obtained with the different choices from the Explorer and the sample amqsbcg.

To create messages with properties, the following samples are used:

JMS: See the JMS sample provided with the following techdoc:
Sample: SampleJMSMsgProperty.java
Using an MDB with JMS message selectors with WebSphere MQ V7 and WebSphere Application Server V7

C: See the C sample:
amqsstm

Source for the C samples:

AIX/Unix: $MQ_HOME/samp/amqsbcg0.c / amqsstma.c
Windows: $MQ_HOME\tools\c\Samples\amqsbcg0.c / amqsstma.c

Executable:
AIX/Unix: $MQ_HOME/samp/bin/amqsbcg / amqsstm
Windows: $MQ_HOME\tools\c\Samples\Bin\amqsbcg.exe / amqsstm.exe

Where $MQ_HOME is the appropriate location for your operation system:
AIX: /usr/mqm
Unix: /opt/mqm
Windows: C:\Program Files\IBM\Websphere MQ


a) MQ Explorer V7

The following IBM Redbook publication has a very good section on this topic:

WebSphere MQ V7.0 Features and Enhancements (SG24-7583)


Chapter 8. Administration enhancements 159
8.1.2 Browsing messages

The presentation format for displaying message properties of browsed messages can also be specified:
- Do not show message properties.
- Show message properties as defined by the queue being browsed, as per the property control (PROPCTL) attribute.
- Show message properties as name properties with values that are separate from the display of message data.
- Show message properties as name properties with values, and also show the MQRFH2 structure containing the properties in the display of message data.
- Only show message properties as name properties with values and show the MQRFH2 structure based on the message content.

To set these preferences go to the main menu and select Window > Preferences.
In the left pane of the window displayed, select WebSphere MQ Explorer > Messages. See Figure 8-5.

>> Note: The following snapshot was taken in 7.0.1.0 - there is no chose "as defaulted by the queue" as in MQ 7.0.0.0.
The default is:
(x) Show message properties:
(*) as Named Properties




Figure 8-5 Message browsing preferences

Browsing message properties

The new option named properties has been added to the message browsing window, as illustrated in Figure 8-6.


Figure 8-6 Browsing message properties

This example shows a property in a Publish/Subscribe message. The property name top has the value /order.

b) Browse example:

+++ Examples

+++
+++ 1) JMS Message with NO message properties.
+++

1.a) amqsbcg Q1 QM_ANGELILLO

****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 273  CodedCharSetId : 1208
  Format : 'MQHRF2  '
  Priority : 4  Persistence : 1
  MsgId : X'414D5120514D5F414E47454C494C4C4F9269BA4A20001D02'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'QM_ANGELILLO                                    '
  ** Identity Context
  UserIdentifier : 'rivera      '
  AccountingToken :
   X'16010515000000F275716EEB186F1B6E69D430EC03000000000000000000000B
  ApplIdentityData : '                                '
  ** Origin Context
  PutApplType    : '28'
  PutApplName    : 'WebSphere MQ Client for Java'
  PutDate  : '20090923'    PutTime  : '18564517'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'

****   Message      ****

 length - 191 bytes

00000000:  5246 4820 0000 0002 0000 0094 0000 0111 'RFH .......ö....'
00000010:  0000 04B8 4D51 5354 5220 2020 0000 0000 '....MQSTR   ....'
00000020:  0000 04B8 0000 0020 3C6D 6364 3E3C 4D73 '....... <mcd><Ms'
00000030:  643E 6A6D 735F 7465 7874 3C2F 4D73 643E 'd>jms_text</Msd>'
00000040:  3C2F 6D63 643E 2020 0000 0048 3C6A 6D73 '</mcd>  ...H<jms'
00000050:  3E3C 4473 743E 7175 6575 653A 2F2F 2F51 '><Dst>queue:///Q'
00000060:  313C 2F44 7374 3E3C 546D 733E 3132 3533 '1</Dst><Tms>1253'
00000070:  3733 3232 3035 3135 363C 2F54 6D73 3E3C '732205156</Tms><'
00000080:  446C 763E 323C 2F44 6C76 3E3C 2F6A 6D73 'Dlv>2</Dlv></jms'
00000090:  3E20 2020 4A6D 7350 726F 6475 6365 723A '>   JmsProducer:'
000000A0:  2059 6F75 7220 6C75 636B 7920 6E75 6D62 ' Your lucky numb'
000000B0:  6572 2074 6F64 6179 2069 7320 3132 35   'er today is 125 '

1.b) MQ Explorer

Using default: as Named Properties



+++
+++ 2) JMS Message with one message property: color = red
+++

The message was created with the JMS sample provided with the following techdoc:
Sample: SampleJMSMsgProperty.java

Using an MDB with JMS message selectors with WebSphere MQ V7 and WebSphere Application Server V7

2.a) amqsbcg Q1 QM_ANGELILLO

>> Notice: <color>red</color"

 length - 220 bytes
00000000:  5246 4820 0000 0002 0000 00B8 0000 0111 'RFH ............'
00000010:  0000 04B8 4D51 5354 5220 2020 0000 0000 '....MQSTR   ....'
00000020:  0000 04B8 0000 0020 3C6D 6364 3E3C 4D73 '....... <mcd><Ms'
00000030:  643E 6A6D 735F 7465 7874 3C2F 4D73 643E 'd>jms_text</Msd>'
00000040:  3C2F 6D63 643E 2020 0000 0048 3C6A 6D73 '</mcd>  ...H<jms'
00000050:  3E3C 4473 743E 7175 6575 653A 2F2F 2F51 '><Dst>queue:///Q'
00000060:  313C 2F44 7374 3E3C 546D 733E 3132 3534 '1</Dst><Tms>1254'
00000070:  3734 3931 3030 3932 313C 2F54 6D73 3E3C '749100921</Tms><'
00000080:  446C 763E 323C 2F44 6C76 3E3C 2F6A 6D73 'Dlv>2</Dlv></jms'
00000090:  3E20 2020 0000 0020 3C75 7372 3E3C 636F '>   ... <usr><co'
000000A0:  6C6F 723E 7265 643C 2F63 6F6C 6F72 3E3C 'lor>red</color><'
000000B0:  2F75 7372 3E20 2020 5465 7874 2063 7265 '/usr>   Text cre'
000000C0:  6174 6564 2062 7920 5361 6D70 6C65 4A4D 'ated by SampleJM'
000000D0:  534D 7367 5072 6F70 6572 7479           'SMsgProperty    '

2.b) MQ Explorer

2.b.1) As Named Properties










2.b.2) As an MQRFH2 structure in message body












...


2.b.3) As an MQRFH2 structure in message body, compatible with WebSphere MQ V6

Same as 2.b.2

+++
+++ 3) Non-JMS message with a message property
+++

The message property was created using the C sample: amqsstm

$ amqsstm Q1 QM_ANGELILLO
Sample AMQSSTMA start
target queue is Q1
Enter property name
color
Enter property value
red
Enter property name

Enter message text

Sample AMQSSTMA end

3.a) amqsbcg Q1 QM_ANGELILLO

Notes:
The header of amqsbcg0.c mentions 6 different ways to display the message properties.
The amqsbcg command was invoked with a single digit to pass the desired way to display the properties:

PROPS_AS_Q_DEF: amqsbcg Q1 QM_ANGELILLO 0
PROPS_IN_MSG_HANDLE: amqsbcg Q1 QM_ANGELILLO 1
PROPS_NONE: amqsbcg Q1 QM_ANGELILLO 2
PROPS_IN_MQRFH2: amqsbcg Q1 QM_ANGELILLO 3
PROPS_COMPATIBILITY: amqsbcg Q1 QM_ANGELILLO 4
PROPS_LAST: amqsbcg Q1 QM_ANGELILLO 5

C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 0 > message-property_0.txt
C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 1 > message-property_1.txt
C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 2 > message-property_2.txt
C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 3 > message-property_3.txt
C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 4 > message-property_4.txt
C:\MQ-doc\techdocs>amqsbcg Q1 QM_ANGELILLO 5 > message-property_5.txt

C:\MQ-doc\techdocs>dir mes*.txt
10/05/2009 10:38 AM 1,618 message-property-0.txt
10/05/2009 10:38 AM 1,403 message-property-1.txt
10/05/2009 10:38 AM 1,333 message-property-2.txt
10/05/2009 10:38 AM 1,618 message-property-3.txt
10/05/2009 10:38 AM 1,618 message-property-4.txt
10/05/2009 10:38 AM 1,618 message-property-5.txt

From the sizes of the output files for THIS EXAMPLE, there are only different 3 types that will be discussed in detail:

3.a.1) PROPS_IN_MSG_HANDLE (message-property-1.txt)

The main differences are:
a)  Format : 'MQSTR   '
b) There is an explicit section with the message properties.
c) The section for the message data does not show anything. (The message did not have additional text, only the message property)


AMQSBCG0 - starts here
**********************
 MQOPEN - 'Q1'
 MQCRTMH
 
 MQGET of message number 1
****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 546  CodedCharSetId : 437
  Format : 'MQSTR   '
  Priority : 0  Persistence : 0
  MsgId : X'414D5120514D5F414E47454C494C4C4FACE3C94A2000B902'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'QM_ANGELILLO                                    '
  ** Identity Context
  UserIdentifier : 'rivera      '
  AccountingToken :
   X'16010515000000F275716EEB186F1B6E69D430EC03000000000000000000000B'
  ApplIdentityData : '                                '
  ** Origin Context
  PutApplType    : '11'
  PutApplName    : 'ls\c\samples\bin\amqsstm.exe'
  PutDate  : '20091005'    PutTime  : '13510592'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'
 
****Message properties****

  color : 'red'
 
****   Message      ****
 
 length - 0 bytes
 
00000000:                                          '                '
 
 No more messages
 MQDLTMH
 MQCLOSE
 MQDISC


3.a.2) PROPS_NONE (message-property-2.txt)

The main differences are:
a)  Format : 'MQSTR   '
b) The section for the message data does not show anything. (The message did not have additional text, only the message property)

AMQSBCG0 - starts here
**********************
 MQOPEN - 'Q1'
 
 MQGET of message number 1
****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 546  CodedCharSetId : 437
  Format : 'MQSTR   '
  Priority : 0  Persistence : 0
  MsgId : X'414D5120514D5F414E47454C494C4C4FACE3C94A2000B902'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'QM_ANGELILLO                                    '
  ** Identity Context
  UserIdentifier : 'rivera      '
  AccountingToken :
   X'16010515000000F275716EEB186F1B6E69D430EC03000000000000000000000B'
  ApplIdentityData : '                                '
  ** Origin Context
  PutApplType    : '11'
  PutApplName    : 'ls\c\samples\bin\amqsstm.exe'
  PutDate  : '20091005'    PutTime  : '13510592'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'
 
****   Message      ****
 
 length - 0 bytes
 
00000000:                                          '                '
 
 No more messages
 MQCLOSE
 MQDISC

3.a.3) PROPS_IN_MQRFH2 (message-property-3.txt)

The main differences are:
a)   Format : 'MQHRF2  '
b) The section for the message data shows the RFH2 header

AMQSBCG0 - starts here
**********************
 MQOPEN - 'Q1'
 
 MQGET of message number 1
****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 546  CodedCharSetId : 437
  Format : 'MQHRF2  '
  Priority : 0  Persistence : 0
  MsgId : X'414D5120514D5F414E47454C494C4C4FACE3C94A2000B902'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'QM_ANGELILLO                                    '
  ** Identity Context
  UserIdentifier : 'rivera      '
  AccountingToken :
   X'16010515000000F275716EEB186F1B6E69D430EC03000000000000000000000B'
  ApplIdentityData : '                                '
  ** Origin Context
  PutApplType    : '11'
  PutApplName    : 'ls\c\samples\bin\amqsstm.exe'
  PutDate  : '20091005'    PutTime  : '13510592'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'
 
****   Message      ****
 
 length - 72 bytes
 
00000000:  5246 4820 0200 0000 4800 0000 2202 0000 'RFH ....H..."...'
00000010:  B501 0000 4D51 5354 5220 2020 0000 0000 '....MQSTR   ....'
00000020:  B804 0000 2000 0000 3C75 7372 3E3C 636F '.... ...<usr><co'
00000030:  6C6F 723E 7265 643C 2F63 6F6C 6F72 3E3C 'lor>red</color><'
00000040:  2F75 7372 3E20 2020                     '/usr>           '
 
 No more messages
 MQCLOSE
 MQDISC


3.b) MQ Explorer

3.b.1) As Named Properties








3.b.2) As an MQRFH2 structure in message body







3.b.3) As an MQRFH2 structure in message body, compatible with WebSphere MQ V6

Same as 3.b.2

3.b.4) Not showing the message properties








+++ end +++

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Function","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.0;7.5;7.1;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
17 June 2018

UID

swg27017014