27. Func='mqbrowse' and other access to MQSeries

RXS reads and writes queues defined in IBM Webspere MQSeries. Any changes on queues during the access are committed, provided the RXS program ends normally. If the program ends in error (error related to MQSeries or any other error), if the user leaves the program reversing out through the first window of the dialogue (according to Section 21a), or if the RXS program terminates in a programmed exit or return, then all MQSeries changes are rolled back.


General order mq contains the name of the actual MQSeries system. mq may only be given one value in a RXS program: a RXS program cannot access several MQSeries queue managers. Default value for mq is stated at installation of RXS.

In RXS, a MQ message can hold up to 16 MB of data.

27a. Reading messages from MQSeries: Func='mqbrowse'


For func='mqbrowse' the name of the queue to read from is stated in general order in.


As general order for the action block may be stated readlim: the maximum number of messages to be read. Default for readlim is 3,000,000.


The reading assigns values to these variables:


Contains the current message


Backout-count, that is the number of times this message previously has been read in vain, because of rollbacks in a reading application


Message-ident: a 24 character field containing the unique key assigned to the message by MQSeries


Date at which the message was created on the queue


Time at which the message was created on the queue (Greenwich mean time)


A name of the application which created the message on the queue


The environment of the application that created the message on the queue (CICS, DOS, AIX, MVS, OS390, WINDOWS...)

Each message triggers the action block. In MQSeries terms, 'mqbrowse' is a MQGET with the browse-flag set.

27b. Destructive reading of MQSeries: Func='mqdrain'

func='mqdrain' functions like func='mqbrowse', but reading is destructive, meaning that the accessed queue is empty after reading. In MQSeries terms, 'mqdrain' is a normal MQGET. A value in readlim will limit the destructive reading, for instance readlim=30 will read and delete the 30 oldest messages on the queue.

27c. Destructive reading of one message: Func='mqdrainkey'


func='mqdrainkey' works like func='mqdrain', but only one message is read. The message to be read is stated in general order mq_messid (24 character MQ-message-id).

Reading is destructive, meaning that the one message read is removed from the queue.

Example 27.1

)action in='ourqualf.inpque'

)& func='mqbrowse'

if substr(unit.1,4,10) = '2007-01-06' then do


)action in='ourqualf.inpque'

)& func='mqdrainkey'

)& mq_messid=foundmess

"Deleted: "left(unit.1,40)




The program deletes all messages having date '2007-01-06' from the stated queue. The date is located in position 4 in the messages and is 10 bytes long. A report is written on <user>.RXS.DATA containing the first 40 byte of every deleted message.                                                   

27d. Writing messages to MQSeries: Outfunc='mqput'

out outfunc

If an action block has outfuc='mqput' output will be written to the MQSeries queue named by general order out.

Example 27.2

)action out='ourqualf.thisque'

)& outfunc='mqput'

)& mq='mqdc'

"What hath God wrought?"

"One small step for man, a giant leap for mankind"


This RXS program writes two messages on the MQSeries queue 'ourqualf.thisque'. The queue belongs to MQSeries system 'mqdc'. mq_putappltype is set to 'OS390' and mq_putapplname is set to the current userid.