Implementing Job Accounting
Determine Structure of Accounting Code
The first thing that you have to consider when implementing job accounting is how to construct your accounting code. The accounting code is a 15-character string. A typical example of how an accounting code might be constructed is given below:
01–03 Country identifier
04–06 City/Town identifier
07–09 Department identifier
10–12 Position identifier
13–15 User identifier
An example might be FRAPARACCMGRLEE; this would indicate an Accounts Manager working in the Paris office in France whose initials might be LEE.
Apply Accounting Codes to User Profiles
Having decided how you're going to construct your accounting codes, you then have to apply them to each of your user profiles. An example is shown below:
This indicates a Sales Manager working in an office in Gillingham in Great Britain.
Create the Job Accounting Journal and associated Receiver
Having now applied an accounting code to each user profile, you now have to start Job Accounting on the iSeries that you wish to capture Job Accounting data for.
The first is to create the Job Accounting journal receiver:
CRTJRNRCV JRNRCV(QUSRSYS/QACGJR0001) TEXT('JOB ACCOUNTING RECEIVER')
Now create the Job Accounting journal:
CRTJRN JRN(QSYS/QACGJRN) JRNRCV(QUSRSYS/QACGJR0001) MNGRCV(*USER) TEXT('JOB COUNTING JOURNAL')
Note: ‘Manage receivers’ must be set to *USER to enable QSystem Monitor to delete old receivers.
Change Job Accounting System Value QACGLVL
Finally change the system value QACGLVL to the required level:
To report on spooled printer file resource usage, add the value *PRINT.
Any new job entering the system will now log entries to the accounting receivers.
Highlight any special jobs that require their own Accounting code
Note: You can also change a job’s accounting code manually by running the IBM command CHGACGCDE, either from the command line of an interactive job, or as the first line of a CL program.
The above example might be used before the Year End processing is started, enabling statistics to be gathered for the end of year jobs.
Change QSM system record to gather Job Accounting data
Now that Job Accounting is being collated on the IBM i, you need to configure QSystem Monitor to convert the receivers onto the QSystem Monitor database. This is done within the MONCFG screen, selecting option 3 against the required system as follows:
The job accounting data is collected at the same time as the disk information, selecting option Y against ‘Gather Accounting Information’ will convert the current receiver, delete it and attach a new receiver to the journal. Selecting option G against this parameter will leave the old receiver on the system.
End the product from the host system and then restart it, for this change to take effect.
Once the data is collected within QSystem Monitor (stored on the host system), a whole range of reports (both PC and iSeries) can be generated. An example of the types of reports can be found in the QSystem Monitor manual Section 9.
Schedule MONPURGE to remove old Job Accounting data
The Job Accounting detailed data gets summarised into summary files by the MON.SUMARY job (usually each day). The Job Accounting detailed data files can get very large very quickly, it is therefore important to schedule the MONPURGE command to run on a regular basis.
The above example will purge old data from the Job Accounting detailed data files greater than 30 days old.
Data is collected from the remote systems when the disk data is collected, if job accounting is enabled and the collection function is selected on the central system using MONCFG. The Job Accounting information differs from the other information shown by the monitor, in that it displays numbers rather than rates. CPU, for instance, is displayed as a total number of CPU seconds used, rather than a percentage; and TRN is displayed as a total of transactions processed, rather than an average rate per hour.
Job Accounting information can be displayed by Job Accounting codes or by User IDs. Accounting codes are used to summarise data. They are typically set in the User profile, and are then inherited by all jobs started by that user. They can also be changed during the course of a job using the command CHGACGCDE.
By using the CHGACGCDE in your applications, you could (for instance) report on response time and CPU used by application - Order Entry and Payroll, for example. Job Accounting information can also be used as the basis for Service Level Agreement reporting.
IBM i Reports
The IBM i command MONACTRPT can also be used to print detailed and summary reports of the information displayed in graphical form by this program.
This has a detail and summary view and an example section from a detail report produced by running the following selection follows:
MONACTRPT RPTBY(*JOB) SYS(GBCCS207) USERID(*ALL) DETAIL(*JOB) FDATE(01052010) FTIME(083000) TDATE(01052010) TTIME(235959)
If you decide to switch Job Accounting on you will need to keep an eye on the size of the file MONACT on your host, as you may wish to run MONPURGE a little more often, if you are only after the one report.