Converting job accounting journal entries

 

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

The OUTFILE parameter allows you to name a file or member. If the member exists, it is cleared before the records are written. If the member does not exist, it is added. If the file does not exist, a file is created using the record format QJORDJE. This format defines the standard heading fields for each journal entry, but the job accounting data is defined as a single large field.

To avoid having to process the accounting data as a single large field, two field reference files are supplied to help you in processing the job accounting journal entries. The file QSYS/QAJBACG4 contains the record format QAWTJAJ4 and is used for JB entries. File QSYS/QAPTACG5 contains record format QSPJAPT5 and is used for DP or SP entries. The same format is used for all printer file entries regardless if the output is SP (spooled) or DP (nonspooled). The DP entry for directly printed files contains some fields that are not used; these fields contain blanks.

The following are some approaches you might use:

The following DDS defines a physical file for the JB journal entries using the QAJBACG4 field reference file in QSYS. You can create the file (using the Create Physical File (CRTPF) command) with the same name (QAJBACG4) as the model file.

 R QAWTJAJ4 FORMAT(QSYS/QAJBACG4)
The following DDS defines a physical file for the DP or SP journal entries using the QAPTACG5 field reference file in QSYS. You can create the file (using the CRTPF command) with the same name (QAPTACG5) as the model file.
 R QSPJAPT5 FORMAT(QSYS/QAPTACG5)  
You can specify a key field in either physical file; however, in this example, a logical file is used for sequencing. If you create two physical files (one for JB and one for DP or SP) with the members of the same name, you can issue the following DSPJRN commands to convert the entries. Assume that you have created the physical files with the same names as the model files in your library YYYY.
DSPJRN JRN(QACGJRN) JRNCDE(A) ENTTYP(JB) 
OUTPUT(*OUTFILE) OUTFILE(YYYY/QAJBACG4) 
DSPJRN JRN(QACGJRN) JRNCDE(A) ENTTYP(SP DP) 
OUTPUT(*OUTFILE) OUTFILE(YYYY/QAPTACG5)
You can control the use and selection criteria of the DSPJRN command so that you do not convert the same entries several times. For example, you can select all entries in a specific range of dates. You can convert all of the entries at a cutoff point for your job accounting analysis, for example, monthly. One or more journal receivers might have been used during the month. Note that each use of the DSPJRN command to the same member causes the member to be cleared before any new entries are added. Do not use the JOB parameter of the DSPJRN command as some entries are made for a job by a system job and will therefore not appear as you expect them to.

Allowing the Processing of Both Physical Files:

Enter the following DDS to create a logical file to allow processing of both physical files. This allows you to read a single file in accounting code order and print a report using a high-level language program:

R QAWTJAJ4  PFILE(YYYY/QAJBACG4) 
K JACDE 
R QSPJAPT5 PFILE(YYYY/QAPTACG5) 
K JACDE
Processing Basic Job Accounting Record:

If you want to use a logical file to process only the basic job accounting record in accounting code order by a user name, you can enter the following DDS for a logical file:

R QAWTJAJ4 PFILE(YYYY/QAJBACG4) 
K JACDE 
K JAUSER 
This logical file can be processed by the query utility or by a high-level language program. If an abnormal system ending occurs, the qualified job name in the first 30 bytes of the JARES field in the journal entry describe the system job that wrote the entry at the next IPL and not the job that used the resources. For this reason, any analysis done on the JB entries should use the JAJOB, JAUSER, and JANBR fields.

 

Parent topic:

Managing job accounting