Take the 2-minute tour ×

I use the following to write queue contents to a file:

q -xb -ITESTQ -mTEST > messages.out

I had 3 binary messages in the queue that got written to the file successfully. Now I have a need to load the same file back to the queue (same queue at a later time). When I do:

q -xb -oTESTQ -mTEST < messages.out

It puts 9 messages instead of 3. I am guess the formatting is misread while the file is loaded. I've noticed there is -X option in the q program. What is the usage of it? What other options I have?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You really need to look at the QLoad program (SupportPac MO03) for this. Same author as the Q program and every bit as good a tool. Also free. As the author explains in the manual:

Ever since I released my MA01 (Q Utility) SupportPac I have had periodic requests to explain how it can be used to unload, and subsequently reload, messages from a queue. The answer has always been that this is not what MA01 is for and that surely there must be a utility available. Well, after sufficient numbers of these requests I looked for a utility myself and didn’t really find anything which fitted the bill. What was needed was a very simple, some would say unsophisticated, program which unloaded a queue into a text file. The notion of a text file was important because a number of users wanted the ability to change the file once it had been created. I also find that text based files are more portable and so this seemed useful if we want to unload a queue, say on Windows, and then load the messages again on a Solaris machine. The disadvantage of this approach is that the file is larger than it would be in binary mode. Storing data using the hex representation of the character rather than the character itself essentially uses twice as much space. However, in general I do not envisage people using this program to unload vast amounts of message data but a few test messages or a few rogue messages on the dead letter queue which are then changed and reloaded elsewhere.

share|improve this answer
Hi Rob, I got ma01 working however it only deals with either Text or amqsbcg output (hex strings), correct? I deal with binary messages (ObjectMessage not TextMessage). Does MO03 support load/unload of binary messages? Rigid networking and security policies does snot allow me to download and play with it myself. –  arrehman Aug 14 '12 at 17:40
Yes. This is what Paul means in the quoted passage above when he talks about storing the message as hex characters and taking up twice the space as if it were stored in binary. Essentially, MO03 takes a hex dump of the message so that it is human-readable but then it can recreate the binary from the hex easy enough. –  T.Rob Aug 15 '12 at 5:50
add comment

Your Answer


