Do you have a number of commands, or scripts, or batch jobs that you regularly use against your queue managers? How would like to be able to invoke them from the queue manager menu in MO71? In the latest version of MO71 just released, you can do just that. This might be useful when setting up MO71 for your operations team to use (see Delivering an MO71 Bundle to your MQ team) to pre-configure MO71 with the various scripts they should be using for tasks outside MO71.
Of course, not all user commands you might want to run would apply to all queue managers in your MO71 configuration, so when setting up User Commands in MO71 you can say which queue managers they apply to. For example, if your queue manager is local to MO71 you can use commands such as strmqm, but for remote queue manager’s you’ll need some sort of remote script to achieve the same. The easiest way to categorize your queue managers is to put them into various “networks” (MO71’s way of categorizing them – see Can you see your QMgr for the trees?). You could imagine a network called “Local” and another called “Remote” which you can then use to determine whether the User Command that runs strmqm can be used. You can make one User command definition which applies to all queue managers in the “Local” network and use the %q substitution character to pass the queue manager name through to the command.
Here you’ve seen an example of a substitution character allowing you to pull information from the location to build up the command. Other substitutions that pull information from the location details are as follows. If there are other things that might be useful to use from the location details as substitutions in User Commands, let us know.
|%c||Location CLNTCONN connection name|
|%g||Location Group Name|
|%q||Queue Manager Name|
If you need to use any environment variables, for example MQ_DATA_PATH or MQ_INSTALLATION_PATH, these can also be used in substitutions in your User Commands with the following syntax:-
For “Remote” queue managers you might want to have quick access to a telnet/putty/ssh session to the machine the queue manager is running on. The session you use might vary based on the platform of the machine. For example, for your z/OS queue managers you might want to start a 3270 session. So there’s another possible network, you could also categorize your queue managers by platform. You can use the %c substitution character to pass the connection name (without port number) through to the command.
These User Commands can run anything you can imagine doing in a script. These might be quite simple wrapper scripts or quite complex scripts. You could use it to run an MQSCX script that generates a report with a known file name, and then open the script with something like notepad to view the results.
mqscx -x -f -C "=import file(C:\MQGem\MQReport.mqx) parms(%1)" notepad C:\MQGem\Output\MQReport_%1_%2_%3_%4.txt
The User Command would then run the command file:
C:\MQGem\runReport.cmd %q %y %m %d
When generating files, it is common to use dates and times in the file names. The other inserts available as substitutions in User Commands are those you can use to generate dates and time, as follows.
|%d||Day of the month e.g. 16|
|%D||Day of the month e.g. Mon, Tue, Wed|
|%H||Current time hours|
|%m||Current Month e.g. Jan, Feb, Mar|
|%M||Current time minutes|
|%S||Current time seconds|
|%t||Current time in HH.MM.SS format|
|%y||Four digit year|
You can also start other programs directly from MO71, and pass in the queue manager name as a parameter where required. For GUI applications make sure the User Command is defined with Hidden set to No or the GUI won’t be visible. If you are an MQSCX user as well as an MO71 user, you may prefer to use MQSCX rather than the MQSC window in MO71 for command line operations. You can create a user command to start an MQSCX session up for the queue manager through a User Command.
The flexibility of running any command scripts means you can do a lot with this, but if you think of other inserts or requirements on this feature, please drop us a line, or leave a comment below to let us know.
The new version can be downloaded from the MO71 Download Page. Any current licensed users of MO71 can run the new version on their existing licence. If you don’t have a licence and would like to try out MO71 then send an email to firstname.lastname@example.org and a 1-month trial licence will be sent to you.