Guru: At Last! A Tool To Search an Output Queue!
November 6, 2017 Ted Holt
As far as I’m concerned, a technician can’t have too many tools! I appreciate the good people of IBM for the software tools they provide to help us do our jobs. I also appreciate those people who freely share software tools they’ve written. I’m pleased to pass along a tool from faithful reader Tim Swearingen.
The tool is a CL command called Search an Output Queue (SRCHOUTQ), and it fills a gap. You can use SRCHOUTQ to look for a string inside the spooled files of an output queue. The search, I am happy to say, is case-insensitive. Here’s more information, in Tim’s words:
Earlier this year, as I was working on a project, we would have random failures that our users didn’t report. We knew we had a problem, but we couldn’t replicate the issue. The issue would be reported in the job log, but sifting through thousands of job logs hunting for the problem was a bit much.
This story contains code, which you can download here.
I had read in other articles that I could use Qshell’s catsplf and grep utilities to search the text of a spooled file. That was enough to motivate me into building a tool that would search an output queue for a desired string and display the results.
The program doesn’t run fast when it is doing a text search. It has to do a brute force text search of each spooled file in the output queue you select. However, it won’t consume a lot of your system resources.
When you run a search by *NAME, the search is much quicker as it is only scanning the spooled file attributes. The attributes searched are: name, owner or user data. A name search will make it easy to subset a group of spooled files in an OUTQ.
SRCHOUTQ has three parameters:
Parameter | Description | Remarks |
OUTQ | The name of the output queue to search. | Press F4 to be prompted with a list of the output queues in the library list. |
SRCHTYPE | Determines the type of search being done. A text search will search the text in a spooled file. A Name search will search the attributes of spool files in the OUTQ | *TEXT = Search spooled files for a text string
*NAME = Search spooled files by Name, Owner or User data |
SRCHSTRING | The search argument | Case-insensitive |
Here’s the prompted :
And here’s the result of a search :
Says Tim,
The results show up in a screen with options that are similar to those of the Work with Output Queue (WRKOUTQ) command. The display options are loaded from physical file SRCHOUTQOP. You can add, change, or delete options to fit your needs.
Two downloadable save files accompany this article. The SRCHOUTQ save file has all of the objects for this tool compiled for IBM i 7.1. SRCHOUTSRC has the source code.
Tim recommends you create a library named SRCHOUTQ and restore all the objects from the save files to that library, but that’s not a requirement. You can place the objects in any library you prefer.
I appreciate Tim’s willingness to share this utility with fellow readers. I hope you will find it useful.
RELATED STORY
Case-Insensitive Searching Of Spooled Files
Copy Source not included in download?
Some better option than my older tool. http://bryandietz.us/scansplf.html
Hi Ted and Tim.
This is a great tool. I have downloaded the objects and source. Just testing the pre-compiled objects works fine, but I am trying to copy the source and create objects in my system. You have not included the source for “/Copy Source,ErrStatus ” in your savf. Could you possibly supply that source? Thanks!
Good utility,created 7 using it.
Tim should take out the Copyright & other personal comments from the source code while sharing it to public.
Hope is employer has no objections to share it with cc comments.
Hi Ted and Tim,
This is a great tool. I have successfully used the objects that you supplied in the save files to search an outq. However, when trying to compile the code that was supplied, i realized you left out one of the copy source members ‘/Copy Source,ErrStatus’. Could you please supply it in the comments or in another savf? Thanks!
Some of the source members were omitted from the download. The complete source code should be there now.
It works well, but it is very slow. Takes forever to search through a large outq