iCan Blog Archive

In the 7.1 release, the Work with Job (WRKJOB) command was enhanced; you can determine this by going to the CL Command Finder and take the option to display “All changed commands.” The Knowledge Center will show you a list of changed commands and you can read the documentation on the command. Of course, there’s a slight problem in that commands are not change-flagged, so you cannot actually see what changed. You need to compare the command documentation with that of the prior release to figure out exactly what has changed. IBM finally started change flagging commands with the 7.4 release.

By comparing the 6.1 version of WRKJOB with the 7.1 version, you will discover that IBM added a new parameter, Select Thread (SLTTHD) to the command. Upon first glance, it might appear that this allows you to simply work with a specific thread for that job; maybe assuming it’s a “fast path” way to do a WRKJOB followed by Option 20 (work with threads). 

But that is not the case.

A blog I wrote nearly three years ago, Display Call Stacks, discussed the various ways you can access call stacks, as well as some enhancements that were made to the call stack itself in the 6.1 release. 

What do these two things have in common? 

The Select Thread parameter provides an interface to print the thread stacks for the initial thread of a process (the default), selected threads in a process, or all threads in a process. Prior to this enhancement, the only way to access all thread stacks within a job was to do it interactively; if you specified OUTPUT(*PRINT), it would just print the call stack of the initial thread. A better way was needed to capture integrated thread stacks (which include the IBM Technology for Java stacks and PASE stacks) for diagnostic purposes, which the addition of the SLTTHD parameter on the WRKJOB command provided.

Here’s how you would print the call stacks for all threads within a specified job:


And here’s how you could select one or more threads from a list; if you select multiple threads from the list presented, each thread’s call stack will be printed in the single spooled file that is generated:


This enhancement is sneaky is because the new parameter, SLTTHD, was hidden from the WRKJOB command prompt – you need to press F9 in order to see it, and because it requires the specific combination of OUTPUT(*PRINT) and OPTION(*PGMSTK) for the option to be valid.

If you have a need to generate spooled output of thread stacks for a job, this handy command invocation will do it for you.

This blog post was originally published on IBMSystemsMag.com and is reproduced here by permission of IBM Systems Media.