Mo72: MQSC Client For Websphere MQ User Guide: 13Th July 2008
Mo72: MQSC Client For Websphere MQ User Guide: 13Th July 2008
Paul Clarke WebSphere MQ Development MP211, IBM UK Laboratories Ltd. Hursley Winchester Hants, SO21 2JN United Kingdom
Take Note! Before using this User's Guide and the product it supports, be sure to read the general information under "Notices
Fifth Edition, July 2008 This edition applies to Version 8 of MQSC Client for WebSphere MQ and to all subsequent releases and modifications until otherwise indicated in new editions. (c) Copyright International Business Machines Corporation 200, 2008. All rights reserved.
Note to U.S. Government Users - Documentation related to restricted rights - Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corporation.
ii
Notices
The following paragraph does not apply in any country where such provisions are inconsistent with local law. INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore this statement may not apply to you. References in this publication to IBM products, programs, or services do not imply that IBM intends to make these available in all countries in which IBM operates. Any reference to an IBM licensed program or other IBM product in this publication is not intended to state or imply that only IBM's program or other product may be used. Any functionally equivalent program that does not infringe any of the intellectual property rights may be used instead of the IBM product. Evaluation and verification of operation in conjunction with other products, except those expressly designated by IBM, is the user's responsibility. IBM may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to the IBM Director of Licensing, IBM Corporation, 500 Columbus Avenue, Thornwood, New York 10594, USA. The information contained in this document has not be submitted to any formal IBM test and is distributed AS IS. The use of the information or the implementation of any of these techniques is a customer responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. While each item has been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will be obtained elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. The following terms are trademarks of the International Business Machines Corporation in the United States and/or other countries: WebSphere MQ IBM z/OS The following terms are trademarks of the Microsoft Corporation in the United States and/or other countries: Windows 95,98,Me Windows NT, 2000,XP
iii
NOTICES ........................................................................................................................................................... III PREFACE ............................................................................................................................................................ V CHAPTER 1. MQSC CLIENT FOR WEBSPHERE MQ......................................................................... 1
MODIFYING THE CLIENT CHANNEL TABLE ........................................................................................................... 2 CONNECTING VIA A CLIENT ................................................................................................................................. 2 CONNECTING VIA A CLIENT BUT TARGETING A DIFFERENT QUEUE MANAGER .................................................... 2 CONNECTING VIA A CLIENT SPECIFYING CHANNEL PARAMETERS ..................................................................... 2 CONNECTING DIRECTLY TO A QUEUE MANAGER................................................................................................. 2 CONNECTING USING THE MQMON.CFG CONFIGURATION FILE .......................................................................... 3 CONNECTING TO A Z/OS QUEUE MANAGER ........................................................................................................ 3 CHAPTER 3. ISSUING MQSC COMMANDS.......................................................................................... 4
SPECIFYING A REPLY QUEUE............................................................................................................................... 4 SPECIFYING A REPLY PREFIX............................................................................................................................... 4 SPECIFYING THE COMMAND QUEUE .................................................................................................................... 4 ISSUING A SINGLE COMMAND FROM THE COMMAND LINE .................................................................................... 4 USING AN INPUT FILE .......................................................................................................................................... 4 USING AN OUTPUT FILE ...................................................................................................................................... 5 CONTROLLING THE WAIT TIME ............................................................................................................................ 5 CHAPTER 4. MODIFYING THE CLIENT CHANNEL TABLE ........................................................... 6
CHANNEL TABLE LOCATION ............................................................................................................................... 6 File Path ......................................................................................................................................................... 6 File Name ....................................................................................................................................................... 6 MQSC SYNTAX................................................................................................................................................... 7 Channel Type.................................................................................................................................................. 7 Generic names ................................................................................................................................................ 7 Where Clause.................................................................................................................................................. 7 Where Clause on Alter.................................................................................................................................... 8 CHANNEL DEFINITION VERSION .......................................................................................................................... 8 AUTHENTICATION INFORMATION OBJECTS ......................................................................................................... 9 CHAPTER 5. DISPLAY OPTIONS.......................................................................................................... 11
COMMAND ECHOING ......................................................................................................................................... 11 NUMBER OF COLUMNS ...................................................................................................................................... 11 OUTPUT WIDTH ................................................................................................................................................. 11 LINE WRAP........................................................................................................................................................ 11 COMPRESS ATTRIBUTES .................................................................................................................................... 12 OUTPUT SEPARATOR ......................................................................................................................................... 12 PROMPT ............................................................................................................................................................. 12 CHAPTER 6. PARAMETER STRING .................................................................................................... 14
RUN TIME CHANGES ......................................................................................................................................... 14 ENVIRONMENT VARIABLE ................................................................................................................................. 14 CHAPTER 7. HISTORY OF CHANGES................................................................................................. 15
VERSION 1.8...................................................................................................................................................... 15 VERSION 1.7...................................................................................................................................................... 15 VERSION 1.2 (JULY 2005 EDITION) .................................................................................................................... 15 VERSION 1.2...................................................................................................................................................... 15 VERSION 1.1...................................................................................................................................................... 15 VERSION 1.0...................................................................................................................................................... 15
iv
Preface
The MQSC Client for WebSphere MQ program came about after various customers asked me for a program providing RUNMQSC capabilities but that was capable of running as a client to a remote Queue Manager. The last request was actually a request for an additional feature to be added to MO71 (my Administration SupportPac). After consideration I decided that the MQSC program was useful in its own right and should be released as a separate SupportPac. However MQSC is capable of reading the MO71 configuration file so there is no need for further configuration. Version 1.7 has introduced another feature which I have often been asked for and that is the ability to display, define and alter channel definitions in the Channel definition table. Since MO72 is essentially an MQSC application which runs on the client it seemed a useful extension to allow channel and authinfo commands to be issued on the client directly at the channel table. 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.
Chapter 1.
Overview
Although the MQSC Client for WebSphere MQ provides an MQSC portal is has two quite distinct modes of operation: 1. For issuing MQSC commands to a Queue Manager through either a local or a client connection.
2. For issuing MQSC commands against the client channel table. This mode does not require a connection to a Queue Manager. All commands are processed directly by the program itself. Both modes also provide a number of additional formatting options for displaying the results of the commands.
Installation
Create a directory, say MQSC, and copy the following files into it : MQSC.EXE (On windows) mqsc (On Unix)
The MQSC Client for WebSphere MQ does not produce a configuration file of its own, but if you are an existing user of the SupportPac MO71: WebSphere MQ for Windows GUI Administrator, and you run MQSC.EXE from the same directory as that program, it will use the MQMON.CFG configuration file produced by MQMONNTP.EXE. This allows you to reuse the same definitions that you have already created. There is an option to control this behaviour, detailed in Connecting using the MQMON.CFG configuration file on page 3. Once the MQSC program is in the path it can be run just by typing mqsc on the command line. No further set-up at this point is required. The program will dynamically load either the WebSphere MQ client or WebSphere MQ Queue Manager libraries as required. Note that to successfully connect to a Queue Manager at least one of these WebSphere MQ products must be installed. The WebSphere MQ client is available for free download at :WebSphere MQ Client Version 6
http://www-1.ibm.com/support/docview.wss?rs=171&context=SSFKSJ&dc=D400&uid=swg24019253&loc=en_US&cs=UTF-8&lang=en&rss=ct171websphere
Chapter 2.
Getting Started
The MQSC Client for WebSphere MQ requires the command server to be running in order for it to operate. On z/OS the command server is automatically started when the queue manager starts, on other platforms use:strmqcsv QM1 You have several connection methods available to you with the MQSC Client for WebSphere MQ.
On Unix this differs from previous versions of the SupportPac where connecting as a client was the default. For consistency with Windows all version will run as a local application unless the client flag is specified.
Chapter 3.
You can issue any of the commands in the WebSphere MQ Script (MQSC) Reference manual via the MQSC Client for WebSphere MQ. These commands may be typed in manually or issued via an input file. The output from the commands can either be displayed in the command window (and there are a number of ways to control the format of this output discussed in Chapter 5. Display Options on page 11) or the output can be sent to a file. MQSC.EXE will not wait indefinitely for commands to complete.
Chapter 4.
To modify the client channel table you need to start the program in client only mode using the n flag. You are then presented with a command prompt. At the command prompt you can enter normal MQSC commands for the manipulation of channels and authinfo objects. The commands supported are: DISPLAY, DEFINE, ALTER, DELETE CHANNEL DISPLAY, DEFINE, ALTER, DELETE AUTHINFO
The syntax and capabilities of the commands are essentially the same as those supported by Queue Managers but there are some key differences explained below. It is strongly recommended that a backup is taken of the client channel table before any commands to alter the file are issued.
File Path
The path to the location is determined using the following values, in order of precedence: 1) Any path specified using the t parameter A path will be considered to be included i if the value contains a directory separator character (or : for Windows). For example, mqsc n t c:\tables\ 2) The value given by the MQCHLLIB environment variable 3) The installed path of WebSphere MQ (Windows Only) 4) Default location a) c:\mqm b) /var/mqm For Windows For Unix
File Name
The name of the file used is determined using the following values, in order of precedence: 1) Any file name given using the t parameter The file name will be assumed to exist if the t parameter does not end with a directory separator. For example, mqsc n t myfile.dat 2) The value given by the MQCHLTAB environment variable 3) AMQCLCHL.TAB
MQSC Syntax
Where ever possible the syntax of the MQSC commands supported on the Queue Managers has been reproduced so it should be possible to run the channel command scripts directly against the program. However, for usability some of features have been extended or restrictions removed.
Channel Type
Normal MQSC channel commands require that the channel type attribute is explicitly specified. Since this program is only concerned with channels with a CHLTYPE of CLNTCONN, this restriction is removed. A channel can be defined as simply as DEF CHL(TEST) and will be a CLNTCONN channel.
Generic names
Queue Manager MQSC commands allow a generic name to be used by specifying a wildcard character at the end of the name. For example, DIS CHL(T*) will display all the channels starting with the character T. This has been extended in the program to allow two forms of wildcards which can be placed anywhere in the string: ? matches a single character * matches zero of more characters So, for example: DIS CHL(*T) DIS CHL(*QM1*) DIS CHL(????)
Will display any channels ending with the character T Will display any channels with QM1 somewhere in the name Will display any channels with a four character name
Where Clause
WebSphere MQ Version 6 introduced the WHERE clause on DISPLAY commands. It is now possible to display objects filtered by something other than their name. The WHERE clause is supported by the program regardless of the version of MQ which actually installed. So, for example: DIS CHL(*) WHERE(HBINT GT 300) Will display any channels with a heartbeat of greater than 300 seconds DIS CHL(*) WHERE(CONNAME LK *1414*) Will display any channels which have the string 1414 in the connection name The WHERE clause has been extended in three ways. 1. Multiple expressions It is possible to link multiple expressions using the operators AND and OR. For example: a. DIS CHL(*) WHERE(HBINT GT 300 AND CONNAME LK *1414*) 2. Object name can be used in the expressions It is possible to use the object name itself in the where expression. For example a. DIS CHL(*) WHERE(CHL GT m) 3. Operators The operators LT,GT,EQ,NE,LE,GE can be replaced with <,>,=,!=,<=,>= respectively. 7
VERSION(5.2). If the version of the client channel is earlier than the support versions, it will be shown as s followed by the MQCD version number, for example, VERSION(s3). DEF CHL(TEST) VERSION(5.3) Write this particular channel at WebSphere MQ 5.3 level. This means that this channel can be read by a WebSphere MQ client at version 5.3 or later. ALTER CHL(*) VERSION(5.3) Alter all channel definitions in the channel file to be written out in WebSphere MQ 5.3 level. This command is clearly useful for migrating channel definitions from one release to the other. Channel records can be altered both to later or earlier releases. Note, however, that when migrating to older levels that some of the information in the channel definition may be lost since the earlier release did not support that option. As usual it is recommended that a backup of the channel table is taken before any modifications are made.
The other requirement when manipulating a list of objects is having some control over the order of the list. In particular it is necessary to have the notion of insert this definition at this point in the list. This is done using the INSERT keyword. This gives us the following options: DEFINE AUTHINFO(1) CONNAME(HOST1) This will define a new AUTHINFO object at the start (position 1) of the list but will fail if the list already contains a definition.
DEFINE AUTHINFO(1) CONNAME(HOST1) REPLACE This will define a new AUTHINFO object at the start (position 1) of the list and will replace any definition currently in the first position. DEFINE AUTHINFO(1) CONNAME(HOST1) INSERT This will define a new AUTHINFO object at the start (position 1) of the list and will push any current definitions further down the list. Note that this means the name by which these subsequent AUTHINFO objects are referred to, changes.
There are two other variations will allow you to define an entry at the end of the list DEFINE AUTHINFO(999) CONNAME(HOST1) Currently you can only define 10 definitions. Any number larger than this will be taken to mean at the end. This command will therefore put this definition at the end of the list. DEFINE AUTHINFO(myname) CONNAME(HOST1) INSERT Although the name of the AUTHINFO should be a number the program will allow the use of a name. This is to maintain as much compatibility with Queue Manager MQSC as possible. Essentially a list of DEFINE AUTHINFO commands will be accepted. Note that the name, regardless of what it is, will be treated as end of the list. So, a list of DEFINE commands will define the objects in the order of the DEFINE commands themselves. Also note that once the definition is made, the name itself is lost. The command DISPLAY AUTHINFO(myname) would therefore fail.
10
Chapter 5.
Display Options
There are a number of options for controlling the display of the output from MQSC commands. These are discussed in this chapter. Many of these options are specified by means of a parameter string.
Command Echoing
To suppress the command issued being echoed to the output use the following option. mqsc m QM1 -e
Number of Columns
To configure the number of columns to be used for the output use the following parameter string. Without this option in effect, the number of columns is based on the width of the command window you issue the command in. mqsc m QM1 p cols=2 AMQ8409: Display Queue details. DESCR(Alias for local queue Q1) CLUSTER( ) QUEUE(Q1.ALIAS) ALTTIME(20.43.51) PUT(ENABLED) DEFPSIST(NO) DEFBIND(OPEN)
Output Width
To configure the width of the output, use the following parameter string. If you do not specify the number of columns to use then that value will be tailored according to the width of the output. If the command output is being sent to a file, the default width is 80 columns. Otherwise, the width is set to the width of the Command Window. mqsc m QM1 p width=30
Line Wrap
To output the result of a command in a single line wrapping must e switched off. mqsc m QM1 p wrap=off
11
Compress Attributes
The command output from some platforms, particularly z/OS, returns space padded values. The default behaviour is to remove these extra spaces and compress the output. To override this default behaviour and see all the spaces, use the following parameter string. mqsc m QM1 p comp=no
Output Separator
By default, each command issued is separated by a WebSphere MQ message before the command output, such as AMQ8409: Display Queue details. There are a number of other possibilities that can be used to separate the output from commands. The values are listed in Table 1: Separator Options below.
Numeric value 0 1 2 3 4
Separator WebSphere MQ message No separator Blank line Single line of dashes Single line of underscores
Table 1: Separator Options These separators can either be before or after the output from the command using the values listed in Table 2: Separator Position below.
Numeric value 0 1
Table 2: Separator Position To use a specific separator use the following parameter string. mqsc m QM1 p detmsg=dotted,detsep=after
Prompt
The prompt for entering commands in MQSC Client for WebSphere MQ can be tailored using the following parameter string, An insert of %m is available to insert the queue manager name into the prompt. The default prompt is the queue manager name followed by >. mqsc m QM1 p prompt=Commands for %m>
12
Connected to Queue Manager 'QM1' Commands for QM1> The list of inserts which can be used in the prompt string are :-
m The target Queue Manager unless the target Queue Manager is also used in the prompt in which case it is the connected Queue Manager. M The target Queue Manager ? Is used to specify part of the prompt which is only displayed if the connected and target queue managers are different. For example the prompt %M%?( via %m)> will display the part in parentheses only if the connected and target Queue Managers are different.
13
Chapter 6.
Parameter String
A number of the behaviours already described are specified by means of a parameter string. There are a number of ways of specifying this parameter string. It can be done on the command line when you start the MQSC Client for WebSphere MQ as already described in the previous chapters. It can also be specified in other ways which are described in this chapter.
Environment variable
You can set these parameters by means of an environment variable named MQSC_PARMS. This allows you to set a default set of parameters so that you dont have to configure it every time you run it. For example: set MQSC_PARMS=cols=3,detmsg=dotted,wait=10
14
Chapter 7.
Version 1.8
History of Changes
Added WebSphere MQ V7.0 channel format support Added C single command parameter Added wrap=off option Added SecurityExit and SecurityData parameters
Version 1.7
Added support for client channel file manipulation Improved usability of display format commands Allowed new M parameter to target a different Queue Manager than the one connected to
Version 1.2
Added R parameter Added support for Via Queue Managers
Version 1.1
Internal only version
Version 1.0
Original version.
15