From: Nancy Edwards To: All
With the S/36, I used to be able to print out the history report and monitor messages and procedures performed on the system. We've recently purchased an AS/400 and I find I cannot retrieve the messages. Is there any way to do this, or are messages not saved anywhere?
From: Ernie Malaga To: Nancy Edwards
The AS/400's equivalent of the S/36's history file is QHST, a *MSGQ object in QSYS that, unfortunately, contains precious little information. However, the AS/400 keeps a history of each job in a much richer fashion in the job's "job log."
The job log is not an object. It acts like a message queue, but you can't access it except via the Display Job Log (DSPJOBLOG) command, while the job is still running. Once the job ends, the job log cannot be accessed anymore. However, you can force the system to print the job log when the job ends by making sure the job has its LOG attribute set to LOG(4 0 *SECLVL) or LOG(4 0 *MSG). The easiest way to get this done is by changing the job description accordingly.
The difference between LOG(4 0 *SECLVL) and LOG(4 0 *MSG) is that *MSG only prints a one-line message describing each command run or each message received as a consequence. *SECLVL, on the other hand, also prints all the second-level text for the messages, resulting in much longer job logs.
To see what I mean, sign on to a display station, execute a few commands (in order to generate some error or completion messages), and then run:
DSPJOBLOG JOB(*) OUTPUT(*)
This shows you the job log as LOG(4 0 *MSG) would have printed it. If you press F10 (Display Detailed Messages), you see the result of LOG(4 0 *SECLVL). By the way, JOB(*) and OUTPUT(*) are the de-fault parameter values, so you can just execute DSPJOBLOG without any parameters. If you change the OUTPUT parameter to *PRINT, the job log listing goes to the printer, of course.
Printed job logs use printer file QPJOBLOG. You can change this printer file's attributes to direct all job log listings to a particular output queue, or to make sure they're automatically held. For instance:
CHGPRTF FILE(QPJOBLOG) + HOLD(*YES)
From here on, job log listings will not start printing automatically; they'll be on hold in the output queue. This gives you an opportunity to look at them or copy them to a database file with the Copy Spool File (CPYSPLF) command. Once the listing is in a database file, you can run a custom-written program to read the file, scanning for any messages you want or looking for commands that were requested by the user (all of which show "RQS" in columns 19-21 of the printout).