This week's blog was written by Mike Russell, who is a member of the IBM i work management team. Everyone knows about the Work with Active Jobs command, but Mike shares some of the lesser known features as well. Thanks, Mike!
This article describes the Work with Active Jobs command. Work with Active Jobs helps you see and manage what is running on your IBM i system. It shows a list of all the active jobs with their current status and basic performance information.
The job type, current user, priority, memory pool, status and number of threads can all be shown by pressing F11. Basic performance information shows the job’s processor usage, paging and interactive response time. Options can be entered to control the job or find more detailed information about a single job. F23 can be used to see all the options available and F24 to see all the function keys available.
For information that can be different for each thread in a job, the initial thread’s information is shown. The status shows whether the job is currently running or not. The status values ending in W show the job is waiting. The same value ending in A means it is waiting in the activity level.
Work with Active Jobs gathers current information for each active job when the command is run and each time the screen is refreshed. The current performance information is compared to information collected at an earlier start time. The difference between the current time and the start time is called the elapsed interval. The elapsed interval is used to calculate the CPU percent, number of interactions, average response time and auxiliary I/O operations for each job. The elapsed interval is shown at the top of the screen along with the percentage of CPU used by the system and number of active jobs. When the WRKACTJOB command is used for the first time in a job, the elapsed interval is zero and no performance data is shown. This is the start time of the elapsed interval. The F5=Refresh key causes the end time of the elapsed interval to be set to the current time, the start time remains the same. The F10=Restart key causes the end time of the elapsed interval to be set to the current time, with the start time set to the previous end time. In other words, F10 shows you what has happened since the last time you looked. F5 extends the elapsed interval. F13=Reset statistics can be used to set the elapsed time to zero and reset the display.
If you are looking for performance problems, you want to use F10 occasionally. With a long elapsed time the performance information becomes watered down, making it difficult to see what's currently happening.
Sorting and limiting
It can be difficult to find what you are looking for in a long list of jobs. There are features in WRKACTJOB to help you find, sort and limit the number of jobs shown. F7=Find displays a pop-up to allow you to enter a search string and what column to search. F8=Repeat find will find the next instance. F18=Bottom and F17=Top will get you to the bottom or top of the list without scrolling.
By default the jobs are grouped under the subsystem they are running in. You can sort the jobs by the values in any column on the display by moving the cursor into the column and pressing F16=Resequence. The SEQ (sequence) parameter on the command can also be used to sort the jobs. And the F20=Subset pop-up also lets you change how the jobs are ordered. Sometimes sorting the jobs into a different order can make it easier to see which jobs are using the processor, work with all jobs in MSGW status, or monitor the paging of jobs running in a memory pool.
By default all active jobs are shown except those that are normally expected to be idle. Idle jobs include the suspended system request and group jobs, disconnected jobs, and prestart jobs that are waiting for a request. You can show the idle jobs by pressing F14=Include. There are several parameters on the command to let you work with a smaller list of jobs. The CPUPCTLMT and RSPLMT parameters let you only see jobs that are using the processor or having long response times. The SBS parameter lets you see only jobs in subsystems you are interested in. The JOB parameter lets you see only jobs matching a generic job name or system jobs or subsystems. The F20=Subset pop up lets you change which jobs are included on the display without exiting the display and entering the command again.
Option 9=Exclude can be used to remove jobs from the display that you're not interested in. This allows you to get the jobs you are interested in on the same screen so you don’t have to roll back and forth to compare their performance information. The jobs remain excluded until you use F13 to reset the display. F21=Nondisplay instructions/keys can be used to get more jobs shown at one time. The option and function key descriptions are removed. F21 again will change back to display the descriptions.
WRKACTJOB can be left running to monitor the system activity by pressing F19=Start automatic refresh. The screen will be refreshed every 5 minutes. You can change how often the screen is refreshed with the INTERVAL parameter. In release 7.1, the automatic refresh function was changed to only show activity for the latest interval. In previous releases, the elapsed time increased each interval to show activity for the entire period since automatic refresh was started, making the information less and less useful over time.
Setting the Function field
The function field usually shows a high-level command, menu or program used by the job. You can use the Change Current Job QWCCCJOB API to customize the function field in a long-running program to something more meaningful. USR- will precede the specified value on the display.