Problem solve Get help with specific problems with your technologies, process and projects.

How to set up a system resource accounting system -- Part II

Ron Turull walks you through three steps for producing useful reports from information gathered from your system resource accounting system.

In the first installment, we discussed how to configure and initiate system accounting. We also discussed how to categorize users by utilizing the ACGCDE (Accounting Code) attribute/parameter of the user profile. Finally, we touched on the following three steps you would normally take to produce a useful report from the information the system gathers:

  1. Pull the journal entries out of the journal receiver(s)
  2. Filter and summarize the entries
  3. Create a report

Now, let's run through these three steps and look at some example solutions to each. We are going to opt for the simple query route for step 3 to minimize programming time. It is important to realize from the start that step 2 is not really a discrete step; filtering and summarizing the journal entries happens as part of step 1 and step 3.

Ron Turull

The first thing you need to do is create a physical file into which the journal entries can be dumped (it is difficult to read journal entries directly, which requires APIs). There is a template file in QSYS named QAJBACG that you can copy to create your own physical file or you can let the DSPJRN command do the work. Deciding which to do depends on whether you are going to write a report program or just use a quick query solution, respectively. Since we are opting for the latter (i.e., quick query), we will let the DSPJRN do the work, as in:



The DSPJRN (Display Journal Entries) command displays a list of journal entries that meet the specified criteria. Here, we have asked for journal entries between two optional date-times (the FROMTIME and TOTIME parameters are two-part parameters -- each has a date and time part, the latter being optional -- so specifying FROMTIME(060103) TOTIME(063003) will collect all journal entries in the month of June 2003, assuming you are using a date format of mmddyy).

We have also specified journal code A and entry type JB. Journal code A collects all the system accounting entries. Entry type JB specifies that we want only job resource information because we are going to run a report to summarize only CPU usage and total pages printed. If you want other information as well, such as specific print information, then you want to also specify entry types DP (for direct print information) and/or SP (spooled print information).

Finally, we have asked for the entries to be dumped into the file ACCG in QTEMP. If the file doesn't already exist, the DSPJRN command will create it based on the aforementioned template file QAJBACG in QSYS.

Now that we have all the entries in a database file, we can query the file and create reports to show utilization. We are interested in summarizing CPU usage and total pages printed by department, which we use the accounting code parameter of the user profile to specify. The following SQL Select statement provides a quick and dirty report that gives us the information nicely summarized:

Select Min(jacde), Sum(jacpu), Sum(japage) from QTEMP/ACCG Group by jacde

The figure below is a sample of the output from the above SQL Select statement. If you want an nice and pretty report, you can use your favorite tools to create it.

The output file from the DSPJRN command contains many fields, and you are encouraged to explore all of them. We have concentrated on just three:

  • JACDE. This is the accounting code that comes from the user profile. We have used it to categorized users into departments.

  • JACPU. This is the CPU time, in milliseconds, used for the job. Our simple SQL report summarize this CPU usage information.

  • JAPAGE. This is the number of pages printed. As noted before, this is the number of pages written to print files, and not necessarily the number of pages actually printed out by printers. Use it carefully.

    Sample output

    MIN ( JACDE )                     SUM ( JACPU )       SUM ( JAPAGE )  
                                           519,266                    18  
    *SYS                                    40,171                     0  
    ACCOUNTING                             435,875                 3,456  
    CUSTOMERSERVICE                        529,984                   975  
    INFOSERVICES                           321,516                   182  

    About the author: Ron Turull is editor of Inside Version 5. He has more than 20 years experience programming for and managing AS/400-iSeries systems.


    • Usage of the system by different users
      A user asked, "I need to collect information of the usage of the system by different users in order to bill them according to the time a user has been logged into the system. Is there anyway I can achieve it through any of the IBM iSeries tools, or are there any other tools available?" Site expert Ken Graap had some advice.
    • Additional techniques for finding system information
      Here are some suggestions for determining the amount of working memory as well as the total and free DASD on a system.
    • Search for the guilty party Sometimes it is nice to be able to backtrack and see who did what and when they did it. Here's an easy way to implement a tracking system on an OS/400 database -- without any significant programming on your part. This technique takes advantage of the OS/400 database audit journal features.

Dig Deeper on Performance

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.