After the job ends, the job log can be written to either the output file QPJOBLOG or a database file.
From the output file QPJOBLOG, the job log can be printed; from a database file, job log information can be queried using a database feature. You can also specify to not write job logs for jobs that have run successfully. When a job's job log output job attribute is *PND, no job log is produced when the job ends, but the pending job log is still accessible from the Work with Job logs command (WRKJOBLOG).
You can use the QMHCTLJL API to write a job log to a database file. When directing the job log to the database file, the system can generate one or two files. The primary file contains the essential information of a message such as message ID, message severity, message type, and message data. The secondary file contains the print images of the message text. Parameters on the QMHCTLJL API control the optional production of the secondary file. You can use database and query features on the system to externally describe and process both files.