Hidden Gems in IBM’s QMGTOOLS Utility Library

Marc Vadeboncoeur, iTech Solutions

The sweetest things in life are free, right?

If you have ever had a complex support case with the IBM i support team in Rochester, they may have instructed you to install the “QMGTOOLS” system utility to gather and also possibly send critical problem-solving information to them to help resolve your system’s issue.  The “MG” in “QMGTOOLS” stands for “Must Gather” as the genesis of the tool was a requirement to package a bunch of commands that collect information that “must be gathered” to resolve certain kinds of support issues.  For many of you, working with QMGTOOLS to provide info to IBM on a technical problem may have been the first time that you’ve ever dealt with the QMGTOOLS utility package, and for many of you who have only worked with QMGTOOLS at IBM’s direction on a support case, or, never even heard of it, read on…

The QMGTOOLS utility is provided free of charge by IBM as an “as-is” (read: no warranty either expressed or implied) collection of powerful command-based tools that most IBM i shops don’t even know they have access to.  The utility is neatly and simply packaged in a standalone library named, you guessed it, “QMGTOOLS”, and there is no installation to run per se, you just need to obtain a save of the library and restore it on your system.  There are 3 ways that you can obtain the QMGTOOLS utility package library:

If you obtain QMGTOOLS via a PTF order, you can apply the PTF immediately and upon doing so the library QMGTOOLS will be on your system.

If you obtain QMGTOOLS via the FTP download, simply do a binary transfer FTP of the save file (.savf) that you downloaded to your PC up to an empty save file on your system and then restore the QMGTOOLS library from the save file like in this example:

RSTLIB SAVLIB(QMGTOOLS) DEV(*SAVF) SAVF(QGPL/QMGTOOL740)
MBROPT(*ALL) ALWOBJDIF(*ALL)

To display the QMGTOOLS main menu, simply type GO QMGTOOLS/MG and the main utility menu shown will appear, and yes, there’s a lot of stuff!

QMGTOOLS is architected/organized as a collection of commands, every option that you see on the QMGTOOLS menus all have discrete commands behind them that you can invoke independently from a command line or a CL program from anywhere on your system, and all the commands exist in the QMGTOOLS library.  Just a common-sense word of caution here, many of the commands in QMGTOOLS are really designed to be used only when directed to do so by IBM support, and those commands are pretty obvious when you read their descriptions, but many of the commands are extremely useful in every day IBM i environments, and I want to highlight just a few of the many “hidden gems” that I have found in QMGTOOLS that many shops may find very valuable.

Job Scanner (JOBSCANNER)

Do you have a need to look for a certain CPF message across a bunch of jobs whether they are active, joblog pending, or completed?  Then this command will do that work for you.  You simply specify the job name that you want to search and the message ID that you’re looking for and the command will look at all jobs by that name whether they are currently active or have completed and display in an IFS .txt file report all jobs that it found with that message ID being issued.  In the below example, I wanted to know which jobs named “ADMIN” issued the message ID “HTP820B” and the results were placed in the output report file SCANOUTPUT.TXT in the IFS, the report shows 2 currently active jobs have issued that message.

Scan a File for a Specific String (SCNFILE)

This command will scan a database file for up to 3 different text string values and place any matching records found in a spooled file report or a database file.  In this example I am looking for any records in file ADDRBOOK in library VEDEMO that have the text string value “MASSIELLO” and the spooled file indicated the record that was found with that value.

ZIP a Directory (ZIPDIR)

Now this one is cool.  Do you have a need to automatically package an IFS directory and all of its contents into an industry-standard .zip archive file?  Well here you go.  In the example below I packaged the entire contents of IFS directory ‘/home/nwilliams’ into a single .zip archive file named “NWILLIAMS.ZIP” in the IFS directory named ‘/tmp’.

TCP/IP Port Scanner (SCNPRT)

This command is one of my personal favorites when it comes to troubleshooting network/firewall issues in IBM i environments.  Do you have an application/function running on your system that needs to access a specific TCP/IP port on a remote system and you need to check if your system has connectivity to the other system over that port?  That remote system can be another IBM i system, a Windows server, a Linux system, etc., then QMGTOOLS’ SCNPRT command is the tool that you need.  In this example, I want to know if the IBM i system that I am on has access to the host named “itech07” over port 21, the command generates a result screen that tells me that port 21 (ftp) is reachable on that system.  You can specify the host name of the remote server or the actual TCP/IP address.

There are over 300 commands in library QMGTOOLS, and IBM adds more commands and enhances the functionality of existing commands on an ongoing basis.  The few examples shown above are just a taste of some of the things that you can do with this incredibly robust collection of custom functions, and it costs you nothing, they are all free and available to you now simply by obtaining the QMGTOOLS library.  Explore all of these commands on your own, you most likely will find quite a few that will secure a permanent spot in your IBM i toolbox.

 

Tagged with: , ,
2 comments on “Hidden Gems in IBM’s QMGTOOLS Utility Library
  1. Michael Mayer says:

    Love it. Have been using it for years. As handy as it gets. And of course, free.

  2. Nick Braker says:

    I’m a regular user of the tool and have added it to the job scheduler to silently check for an upgrade each day. If there is one, the job upgrades QMGTOOLS automatically. I never have to think about it being an old install as it’s always current. I did encapsulate the MG command in a CLLE but it’s not necessary.

    On the job scheduler: CALL PGM(KOLPGM/MGTOOL_UPD)

    In the CLLE program: CmpVer NoPrompt(Y)

    I’m sure y’all can figure out how to make it work for you.

Leave a Reply to Michael Mayer Cancel reply

Your email address will not be published. Required fields are marked *

*