4/13/07 How to ensure a job creates a job log when it ends

Ever have a job that ends abnormally but does not create a job log?

The command CHGJOB *SECLVL can be used to change an active job so that it creates a job log, which will allow you to see what has caused it to end.

From the WRKACTJOB screen, find the job and type a 2 (Change) next to the job, then press F10 (Additional parameters)

The following will appear under Message Logging:
Level . . . . . . . . . . . . > 4
Severity . . . . . . . . . . . > 00
Text . . . . . . . . . . . . . > *NOLIST

In the Text field, change *NOLIST to *SECLVL

You can also change parameters on this screen to log additional information about the CL being run.

In the Log CL Program Commands field change *NO to *Yes

So, the CHGJOB would look like this:

Message logging:
Level . . . . . . . . . . . . 4
Severity . . . . . . . . . . . 00
Text . . . . . . . . . . . . . *SECLVL
Log CL program commands . . . . *YES

This would then produce a joblog such as QEZJOBLOG

If you are running this from a command line - then do a CHGJOB LOG(4 00 *SECLVL) LOGCLPGM(*YES) before running your job. This should produce a job log when it ends abnormally (abend) or is shutdown abnormally.

If you cannot change the job once you logon - then look at what job description is being used and change that to the following:

CHGJOBD LOG(4 00 *SECLVL) LOGCLPGM(*YES)

You may need to change the signoff command to LOG(*LIST) to keep it from ditching the job log. SIGNOFF LOG(*LIST) if this is an interactive job you are wishing to log.


Disclaimer: Vision Solutions makes every effort to provide accurate system management information and programming code; however the company cannot be held liable for the accuracy of information nor its compatibility in your own environment. Please review and test thoroughly before implementing. © Copyright 2008, Vision Solutions, Inc. All rights reserved. IBM, System i, iSeries, and AS/400 are trademarks of International Business Machines Corporation.

No comments: