4
votes

As part of the installation of our application, I need to put a bunch of xml messages into an MQ queue. To make it more complicated, the messages need to have the usr-folder of the RFH2-header set.

I found that mqput2.exe from the IBM RFHUtil is an ideal tool for this task. Unfortunately, I have been unable to make setting of the usr-folder work, the documentation is too vague. What am I doing wrong? Or, is there another command-line tool available that works better?

My prop. file for mqput2 looks like this:

[header]
.....
*
* message type
*
* Allowed values for message type
*  1 - request
*  2 - reply
*  4 - report
*  8 - datagram
*  112 - MQE fields from MQE
*  113 - MQE fields
*  65536 to 999,999,999 - user
msgtype=8
.....
*
* rfh usage
* rfh = N for No rfh
* rfh = A for Automatic (look for RFH at beginning of data file)
* rfh = 1 or V1 for Version 1 rfh from parameters in parm file
* rfh = 2 or V2 for Version 2 rfh from parameters in parm file
* rfh = X for special V2 rfh with fixed portion only and format=xml
*
* only first character checked, except for V when second character is also checked
*
rfh=X

<usr>
  <NotificationType>RDS.Codebook.Changes</NotificationType>
</usr>
.....
[filelist]
file1.xml

mqput2 simply ignores the <usr> section and doesn't include it with the message. I've also tried rfh=A and put the <usr> section at the beginning of the file1.xml file, but then I get MQPUT error reason=2142 (invalid MQ header structure).

2
rfh=2 should be the correct one - Attila Repasi
rfh=2 doesn't allow adding the usr params, at least according to the documentation: "If an individual field in a particular folder is specified...This technique cannot be used for the pscr or usr folders..." (ih03.doc from RFHUtil, p.88). Anyway, after changing to rfh=2, I get reason code 2142. - xarx
Look at page 82 and 83: "If the RFH parameter is set to a value of 2, then the utility will build an RFH header and insert it before the data when writing a message. The contents of the folders in the RFH header can be specified either as individual fields or as a block of text in an XML format." - Attila Repasi

2 Answers

3
votes

Also dmpmqmsg utility, which is part of the WMQ8 installation, can be used for sending the messages from command-line. A message can be exported from a queue including the headers via

dmpmqmsg -m queue_manager> -I <queue> -f <msg_file> -a

and then submitted again via (I think, consult the docs)

dmpmqmsg -m queue_manager> -o <queue> -f <msg_file>

This utility is however not part of WMQ 7.5.

2
votes

I have it set up this way, and it works fine:

[header]
qname=QName
qmgr=QMName
msgcount=1
format= "MQSTR   "
codepage=1208
rfh=2
<usr>
<test>test</test>
</usr>
[filelist]
test.xml