Anyone who has used the Work with System Activity (WRKSYSACT) command can tell you how useful it is to identify jobs in real time that are using too many system resources, usually CPU. What you may not know is that you can also run WRKSYSACT in batch to collect data about how well your system is performing.
When you run WRKSYSACT in batch, data is collected to a default file, or one that you specify, and later you can run another command called Print Activity Report (PRTACTRPT) against the collected data. There are a variety of options in the PRTACTRPT command that allow you to view the data a number of ways so that you can find jobs that may not be performing optimally.
More Information
[IMAGE]
To continue reading for free, register below or login
To read more you must become a member of Search400.com
');
// -->

of right sidebar code snippet -->
You can run PRTACTRPT repeatedly over the same data collection to view the data in different ways. For example, maybe the job that is causing you trouble is not CPU bound, but rather I/O bound. You would be unlikely to see the job if you sorted the results by CPU, but when sorted by total number of I/O's it may stand out like a sore thumb.
Running WRKSYSACT in batch is often a very good place to start when you suspect you have one or more jobs that are misbehaving. It can be especially useful if you have a performance slowdown at a specific time of the day that occurs regularly. You can schedule a run of WRKSYSACT from the job scheduler on the system to capture data during the slowdown even if it is off shift. Later, you can run the PRTACTRPT command to view the data and find those troublemaker jobs. One warning here, you will need to run PRTACTRPT between successive job scheduler runs of WRKSYSACT because WRKSYSACT erases any data in the specified output file when it starts.
To run WRKSYSACT in batch, type in WRKSYSACT at a command line and press F4 to prompt and then F9 to show all parameters. You will see a screen like the one shown in Figure 1.
Figure 1: The WRKSYSACT command
To have WRKSYSACT submitted to batch, specify the output as *FILE. The interval length is the length of time in seconds that WRKSYSACT will run to capture data, i.e. the length of the collection interval. The number of intervals says how many 'collections' you want to make. The two combined tell you how long the WRKSYSACT command will run.
In the example in Figure 1, I have set the interval length to 1 minute and the number of intervals to 10, thus the command will run for 10 minutes and collect 10 different one-minute sets of data. You can leave the 'Sequence' parameter set to *CPU (you can sort the data later with PRTACTRPT) and the 'Type of information parameter' set to *ALL.
Note that you can use WRKSYSACT to only display licensed internal code tasks by setting the Type of Information parameter to *TASKS, in either batch or interactive mode, which can be handy if you suspect your problem is being caused by IBM code and not your application or, more likely, that your application code is driving some LIC tasks very hard. Tasks in the interactive WRKSYSACT display do not have a user profile.
Only one instance of WRKSYSACT can be run at any given time due to the fact that the command runs at a very high system priority. This rule is observed whether you run WRKSYSACT interactively or in batch, so if you specify a very long batch run, you need to remember that you and other users will be locked out of the command for the duration of that run. If WRKSYSACT is already in use, it will send a message with the userid of the person or job currently running it.
Once you have collected data for one or more intervals, you can run the PRTACTRPT. If you type PRTACTRPT at a command line and hit F4 and then F9, you will see a screen similar to that in Figure 2.
Figure 2: The PRTACTRPT command
The Report Type and Sequence parameters are the most important. In Report Type, *DETAIL will give you the type of output that is shown in Figure 3, which shows the detail for one 60-second interval, sorted by *CPU. In the Sequence parameter, specify the way in which you want the data to be sorted. Use the help for the Sequence parameter to see what each value means. Most times you will want to sort by either *CPU or *TOTALIO, but there are several more choices.
The part of the report that is of most interest is the first section, which in Figure 3 shows the top 10 CPU-consuming jobs on the system for the first collection interval (other collection intervals have been removed from the report to simplify the example, but they would be similar in structure to the interval shown). Note that BAD_JOB used 22% of the available CPU during this interval and did very little I/O. This would probably be a job worth investigating, especially if it showed up as the worst offender in multiple intervals.
Figure 3: A sample report from PRTACTRPT
Try WRKSYSACT in batch; you may just discover some troublesome jobs that you didn't know about.
-----------------------------------
About the author: Dan Reusche is a senior systems administrator at Think Federal Credit Union in Rochester, Minn. He has worked with the IBM AS/400 and iSeries platform since 1988, when he worked at the IBM Rochester Development Lab and support of AS/400 systems used within IBM. You may contact him at dreusche@chartermi.net.