Thomas,
Completion messages, e.g.:
CPF1240 Job 710912/MSW/TEST ended abnormally
or
CPF1241 Job 710912/MSW/TEST ended normally on 04/25/18 at 19:05:28.
are normally sent to the job's submitter, or sent to the message queue
identified on the SBMJOB command MSGQ(...) parameter. Whether a job
ends "normally" or "abnormally" is controlled by whether an *ESCAPE
message caused the job to end (abnormally).
Similar messages are logged in the system history log (message queue
QSYS/QHST) -- you can interrogate those messages using the DSPLOG
command ... for example:
DSPLOG QHST PERIOD(('18:00:00' *CURRENT))
shows the messages sent starting at the indicated time and date, on the
display. You can also route the output to *PRINT (a spool file). You
could write a program to read that spool file, (e.g. copy the spool file
to a temporary physical file with CPYSPLF, and then read the data) to
search for what you are seeking.
These are the messages you may be interested in:
CPF1124 Job 710811/MSW/BADJOB started on 04/25/18 at 18:41:05 in
subsystem
QBATCH in QSYS. Job entered system on 04/25/18 at 18:41:04.
and
CPF1164 Job 710811/MSW/BADJOB ended on 04/25/18 at 18:41:06; 1
second used;
**end code 20
For a job that ends normally, you will see:
CPF1164 Job 710811/MSW/BADJOB ended on 04/25/18 at 18:41:06; 1
second used;
**end code 0
The "end code" may be what you referred as a "return code" ...
Once you have found those messages with a non-zero end code, you can
extract the fully qualified job name, e.g. 710811/MSW/BADJOB from the
message text and use that to find the spool file(s) for the job,
including the job log, if needed.
The DSPLOG QHST command shows you only the "current" history;
Periodically, the system flushes the contents of the QHST message queue
to physical files named, e.g.:
Object Type Library Attribute
QHST18085A *FILE QSYS PF
QHST18087A *FILE QSYS PF
etc., where the number is of the form "yyddd" and a suffix, if
needed, starting with "A", etc.
You can read the contents of those files directly with a program --
issue DSPPFM to view their contents; you will see the same messages as
with DSPLOG QHST, but from previously saved ranges of dates.
HTH,
Mark S. Waterbury
> On 4/25/2018 3:35 PM, Burrows, Thomas wrote:
Anyone know of a way to search all joblogs for return codes that are not ZERO.
Does such a tool exist or does someone have something they have written themselves.
Thomas Burrows
Cell 469 693 2533
As an Amazon Associate we earn from qualifying purchases.