Job accounting in a distributed relational database

The IBM® i job accounting function gathers data so you can determine who is using the system and what system resources they are using.

Typical job accounting provides details on the jobs running on a system and resources used, such as use of the processing unit, printer, display stations, and database and communications functions. Job accounting is optional and must be set up on the system.

To set up resource accounting on the system, follow these steps:

  1. Create a journal receiver by using the Create Journal Receiver (CRTJRNRCV) command.
  2. Create the journal named QSYS/QACGJRN by using the Create Journal (CRTJRN) command. You must use the name QSYS/QACGJRN and you must have authority to add items to QSYS to create this journal. Specify the names of the journal receiver you created in the previous step on this command.
  3. Change the accounting level system value QACGLVL using the Work with System Values (WRKSYSVAL) or Change System Value (CHGSYSVAL) command.

    The VALUE parameter on the Change System Value (CHGSYSVAL) command determines when job accounting journal entries are produced. A value of *NONE means the system does not produce any entries in the job accounting journal. A value of *JOB means the system produces a job (JB) journal entry. A value of *PRINT produces a direct print (DP) or spooled print (SP) journal entry for each file printed.

When a job is started, a job description is assigned to the job. The job description object contains a value for the accounting code (ACGCDE) parameter, which can be an accounting code or the default value *USRPRF. If *USRPRF is specified, the accounting code in the job's user profile is used.

You can add accounting codes to user profiles using the accounting code parameter ACGCDE on the Create User Profile (CRTUSRPRF) command or the Change User Profile (CHGUSRPRF) command. You can change accounting codes for specific job descriptions by specifying the desired accounting code for the ACGCDE parameter on the Create Job Description (CRTJOBD) command or the Change Job Description (CHGJOBD) command.

When a job accounting journal is set up, job accounting entries are placed in the journal receiver starting with the next job that enters the system after the Change System Value (CHGSYSVAL) command takes effect.

You can use the OUTFILE parameter on the Display Journal (DSPJRN) command to write the accounting entries to a database file that you can process.