MO03: WebSphere MQ Queue Load / Unload Utility User Guide Version
1.0
WebSphere MQ Queue Load / Unload Utility
Contents
NOTICES...........................................................................................................................................................III
CONTENTS........................................................................................................................................................IV
TABLES...............................................................................................................................................................V
PREFACE...........................................................................................................................................................VI
CHAPTER 1. WEBSPHERE MQ QUEUE LOAD /
UNLOAD UTILITY..............................................1
OVERVIEW..........................................................................................................................................................1
INSTALLATION.....................................................................................................................................................1
Windows DIRECTORY...................................................................................................................................1
AIX DIRECTORY...........................................................................................................................................1
Solaris DIRECTORY......................................................................................................................................1
HP DIRECTORY............................................................................................................................................1
Linux DIRECTORY.........................................................................................................................................1
CHAPTER 2. GETTING STARTED..........................................................................................................2
EXAMPLE 1.
UNLOAD A QUEUE TO A FILE...........................................................................................................2
EXAMPLE 2.
LOAD A QUEUE FROM A FILE...........................................................................................................2
EXAMPLE 3.
COPY THE MESSAGES FROM
ONE QUEUE TO ANOTHER QUEUE........................................................2
EXAMPLE 4.
MOVE THE MESSAGES FROM
ONE QUEUE TO ANOTHER QUEUE.......................................................2
EXAMPLE 5.
WORK WITH THE FILE OF
MESSAGES................................................................................................2
CHAPTER 3. PARAMETERS....................................................................................................................3
CONNECTION METHODS......................................................................................................................................3
FILE USE.............................................................................................................................................................3
QUEUE ACCESS OPTIONS......................................................................................................................................3
CONTEXT OPTIONS..............................................................................................................................................4
DISPLAY OPTIONS...............................................................................................................................................4
Combination of Hex and ASCII data..............................................................................................................4
Interleaved Hex and ASCII data.....................................................................................................................5
Message Index................................................................................................................................................5
SUMMARY DATA.................................................................................................................................................5
MESSAGE SELECTION..........................................................................................................................................6
Search String..................................................................................................................................................6
CHAPTER 4. FILE FORMAT....................................................................................................................8
EXAMPLE - CHANGING THE USER ID...................................................................................................................8
ATTRIBUTE FORMAT REFERENCE........................................................................................................................8
RECOGNISED FILE FORMATS................................................................................................................................9
iv
WebSphere MQ Queue Load / Unload Utility
Tables
Table 1: Context options use by
QLOAD................................................................................................4
Table 2: Message range options
used by QLOAD.................................................................................6
Table 3: Search string options
used by QLOAD.....................................................................................7
Table 4: Meaning of column one
symbol in file format...........................................................................8
Table 5: Message descriptor
attribute representations...........................................................................9
v
WebSphere MQ Queue Load / Unload Utility
Preface
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.
I would like to thank Morag
Hughson for writing this user guide and for testing the described
functionality. Writing the code is the fun bit and without her offering to do
the leg work I doubt whether this SupportPac would have ever seen the light of
day.
I hope you find this program
useful. As always I welcome your comments, both good and bad. Please feel free
to e-mail me with any bug reports or suggestions. vi
WebSphere MQ Queue Load / Unload Utility WebSphere MQ Queue Load / Unload Utility
Chapter 1.
This document describes the functions
available in the SupportPac.
Overview
The WebSphere
MQ Queue Load / Unload Utility allows the user to copy or move
the contents of a queue, its messages, to a file. This file can be saved away
as required and used at some later point to reload the messages back onto the
queue. This file has a specific format understood by the utility, but is
human-readable, so that it can be updated in an editor before being reloaded.
Care should be taken not to change the format when editing fields within it.
The utility will only reload a file with the correct format.
Installation
The following platforms are supplied in the
zip file MO03.zip:
•
Windows
•
AIX
•
Solaris
•
HP
•
Linux
Download this file (in BINARY) to a
temporary directory and unzip with the option to ensure the subdirectories stored
in the ZIP file are re-created). This will create subdirectories containing the
following:
Windows DIRECTORY
• qload.exe
- will run as a client or a Queue Manager program (see -l parameter).
AIX DIRECTORY
• qload
- runs as a Queue Manager program
• qloadc - runs as
a client program
Solaris DIRECTORY
• qload
- runs as a Queue Manager program
• qloadc - runs as
a client program
HP DIRECTORY
• qload
- runs as a Queue Manager program
• qloadc - runs as
a client program
Linux DIRECTORY
• qload
- runs as a Queue Manager program
• qloadc - runs as
a client program
Once unzipped, transfer the appropriate
executable, again in binary, to the destination system.
1
WebSphere
MQ Queue Load / Unload Utility
Chapter 2. Getting Started
The WebSphere
MQ Queue Load / Unload Utility can be useful for a number of
tasks. These are detailed below as simple examples. All of these examples can
be modified with the use of a number of other parameters which are documented
in “Chapter 3. Parameters” on page 3.
Example 1. Unload a Queue to a File Example
1. Unload a Queue to a File
To save the messages that are on a queue, to
a file, perhaps for archiving purposes and the possibility of later reload back
onto a queue; use the following options on the command line.
qload –m QM1 –i Q1 –f c:\myfile
This takes a copy of the messages from the
queue and saves them in the file specified. The format of this file is
described in “Chapter 4. ” on page 8.
Example 2. Load a Queue from a File
To reload a queue with the messages you
saved in “Example 1. Unload a Queue to a File”, use the following options on
the command line. Note that the file passed to WebSphere
MQ Queue Load / Unload Utility must be a recognised format.
The recognised formats are listed in “” on page 9.
qload –m QM1 –o Q1 –f c:\myfile
Example 3. Copy the messages from
one Queue to another Queue
The file parameter in “Example 1. Unload a
Queue to a File” could be replaced with another queue name instead, allowing
the messages from one queue to be copied to another queue, using the following
options on the command line.
qload –m QM1 –i Q1 –o Q2
Example 4. Move the messages from
one Queue to another Queue
A variation on “Example 3. Copy the messages
from one Queue to another Queue” would be to move the messages instead of
copying them. This illustrates the distinction between using –i (lower case) which only browses
a queue, and –I (upper case)
which destructively gets from a queue. Use the following options on the command
line.
qload –m QM1 –I Q1 –o Q2
Example 5. Work with the file of
messages
Having unloaded the message from your queue,
as in “”, you may want to edit the file. You may also want to change the format
of the file to use one of the display options that you did not specify at the
time you unloaded the queue. You can use the WebSphere
MQ Queue Load / Unload Utility to reprocess the file into the
desired format even after the unload of the queue has taken place. Use the
following options on the command line.
qload –f c:\oldfile –f c:\newfile
-dA
File Format
Recognised file formats
2
WebSphere
MQ Queue Load / Unload Utility
Getting StartedGetting Started
Chapter 3. Parameters
There are a number of switch parameters that
can be passed to WebSphere MQ Queue Load / Unload
Utility to control the behaviour you need. These are
detailed in this chapter.
Connection Methods
You have two connection methods available to
you with the WebSphere MQ Queue Load / Unload
Utility. You can either connect directly to a local queue manager, or connect
using a client connection. The default behaviour is to connect directly to the
queue manager. If you have a default queue manager you can omit the –m switch which provides the queue
manager name. To connect to the Queue Manager via a client, using the client
channel table or the environment variable MQSERVER, use the following options
on the command line.
mqsc –m QM1 –l mqic32
File Use
As already seen in “Chapter 2. ” on page 2,
the –f flag is used
to indicate the file name. This file may already exist in which case the
program will ask whether you wish to overwrite it or not. If you select not to
overwrite the file, no messages will be unloaded and the utility will end. You
can select to overwrite the file when asked this question, or you can specify
that the file to be used should be overwritten if it exists by using the –F (upper case) option as shown,
on the command line.
qload –m QM1 –i Q1 –F c:\myfile
If you wish to combine the messages from two
queues into one file, you can use your operating system services to concatenate
the two files together and the format will still be acceptable to WebSphere MQ Queue Load / Unload Utility.
You can also use the –f flag to specify stdout as the output
source instead of a file name. This may be useful if you simply wish to display
the messages on the queue to the screen, or pipe the output another program.
Queue access options
As already seen in “Chapter 2. ” on page 2,
the –o flag is used
to indicate the output queue, that is the queue to which messages are put; the –i and –I flags are used to indicate the
input queue, that is the queue from which messages are browsed or destructively
got.
If the messages on the queue being unloaded
need to be converted, the –c flag
should be used to cause the MQGET call from the input queue to specify
GMO_CONVERT with the CCSID and Encoding values specified. The encoding value
should be specified in hex. Use the following options on the command line.
qload –m QM1 –i Q1 –f c:\myfile –c
850:X’222’
If all that is required is to use the local
code page and native encoding then simply use the following options on the
command line.
qload –m QM1 –i Q1 –f c:\myfile –c
0
3
WebSphere
MQ Queue Load / Unload Utility
File Format
Context Options
There are two sets of context information in
the Message Descriptor (MQMD), the identity context fields and the origin
context fields. These are described in the WebSphere
MQ Application Programming Guide. The default
action of the WebSphere MQ Queue Load / Unload
Utility is to set all the context information in the
MQMD to that which was saved in the file being loaded. This requires the user
ID under which the utility is running to have appropriate authority to set all
the context fields.
The context fields can be manipulated in
other ways using the various other options with the –C flag. “” details the options
that can be used. The main difference to note is that the first two options
are applicable when loading from a file, and the second two options are
applicable when loading one queue from another queue. Option
|
Meaning
|
A
|
Set all the context fields in
the MQMD to that which was saved in the file.
|
I
|
Set only the identity context
fields in the MQMD to that which was saved in the file.
|
A
|
Pass all the context fields in
the MQMD from the messages on the input queue to the messages on the output
queue.
|
I
|
Pass only the identity context
fields in the MQMD from the messages on the input queue to the messages on
the output queue.
|
d
|
Context fields in the MQMD of
messages on the output queue will represent the WebSphere MQ Queue Load / Unload Utility.
|
n
|
There will be no information
in the Context fields in the MQMD of messages on the output queue.
|
Excellent post. Really awesome I don't have words with me to describe about your hard work, Thanks for sharing the post
ReplyDeletespring interview questions
jsp interview questions
c++ interview questions
spring interview questions and answers for experienced
salesforce interview questions