Topic
  • 3 replies
  • Latest Post - ‏2017-06-21T09:05:03Z by xarx2
xarx2
xarx2
3 Posts

Pinned topic Put messages to MQ queue from command-line

‏2017-06-17T15:04:23Z | mqput rfhutill

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:

<code>[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
</code>

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).

  • fjb_saper
    fjb_saper
    240 Posts

    Re: Put messages to MQ queue from command-line

    ‏2017-06-19T18:31:42Z  

    The RFH header is complicated programing an only for very advanced developers. Instead use the properties in handle programing and let MQ create the RFH behind the scenes for you.

  • xarx2
    xarx2
    3 Posts

    Re: Put messages to MQ queue from command-line

    ‏2017-06-21T08:49:03Z  

    I've got a helpful response in https://stackoverflow.com/questions/44605805/put-messages-to-mq-queue-from-command-line/44670920#44670920.
    In the param file, there must be

    rfh=2
    format="MQSTR "
    

    Format MQHRF2 does not work form mqput2.

    The necessity of format MQSTR is strange because in RFHUtil itself it works the other way round: format must be MQHRF2, while MQSTR does not work (the message then doesn't contain the RFH headers).

  • xarx2
    xarx2
    3 Posts

    Re: Put messages to MQ queue from command-line

    ‏2017-06-21T09:05:03Z  

    Another possibility is to use the dmpmqmsg utility from WMQ8 installation. But the utility is not part of WMQ 7.5.

    Updated on 2017-06-21T09:05:43Z at 2017-06-21T09:05:43Z by xarx2