Advanced Job Scheduler help
iSeries expert Ken Graap helps a reader build a CL Program to monitor for job completion using Advanced Job Scheduler on iSeries.
Thanks in advance.
- Job Notification
- Alternate Job
- Displaying Job History
First of all, you need to specify a "Notification Command" for IJS to use when sending messages:
My IJS configuration uses a command called SNDICM. This command is defined to IJS via the CHGNFYJS command:
Change Notification Command (CHGNFYJS)
Type choices, press Enter.
Notification command . . . . . . CMD 'QGPL/SNDICM RCP(&RCP) MSG(''&MSGTXT'')'
Once you have defined a "Notification Command" to IJS you can then utilize the preexisting fields in the IJS job definition.
For example, I have defined a job to send messages for both a *NORMAL completion and an *ABNORMAL completion.
When this job finishes properly, IJS sends a message to SYSADM "Daily Prod BU 10 finished OK"
If it finishes with errors, IJS sends a message to SYSADMCRT "Daily Prod BU 10 had errors"
Display Job S02
7/31/07 8:39:48
Remote location name . . . . : *JOBCTL
Start time and date:
Beginning time . . . . . . : *NONE
Beginning date . . . . . . : *NONE
End time and date:
Ending time . . . . . . . : *NONE
Ending date . . . . . . . : *NONE
Maximum run time . . . . . . : *NOMAX
Notification recipient normal: SYSADM
Notification message . . . : Daily Prod BU 10 finished OK
Notification recipient abnorm: SYSADMCRT
Notification message . . . : Daily Prod BU 10 had errors
Alternate job . . . . . . . : *NONE
Group name . . . . . . . . : *NONE
Group sequence . . . . . . :
Alternate Job:
In my example above I have specified *NONE for the Alternate Job. However, I could have specified another IJS job, and this job would only be executed when the job ends abnormally. This job could be defined to send out notification messages, start other jobs or anything else that you might want to do when a job ends abnormally.
Displaying Job History:
If you choose not to utilize the built in notification features, you can still query the IJS history log using the DSPLOGJS command.
For example the command:
DSPLOGJS PERIOD((*AVAIL *BEGIN)) SEV(20) OUTPUT(*PRINT) DETAIL(*FULL) JOB(D_BU10)
... will scan the IJS History Log and generate a report showing any message with a severity of 20 or greater for job D_BU10.
Here is an example of the report. (Sample re-created by editorial team may differ from actual log output.)
5722JS1 | V5R3MO | Job Scheduler Log | S02 | 7/31/07 | 8:58:28 | ||||
Page | 1 | ||||||||
Date | Time | Message | Sev | Text | Program | ||||
User | Type | ||||||||
8/02/06 | 2:28:55 | BRM10A1 | 40 | Control group D_PRDGEN10 type *BKU completed with errors. Cause . . . . . : Control group D_PRDGEN10 type *BKU completed processing but errors were detected. This may be caused from objects not being saved. Recovery . . . : See previously listed messages to determine possible causes for the errors and for any objects not saved |
QIJSCEC | BACKUP | |||
8/02/06 | 2:28:55 | IJS6008 | 50 | Command sequence 0030 for job D_BU10 group D_BU10 sequence 01 ended in error. Cause . . . . . : Command to execute was: STRBKUBRM CTLGRP(D_PRDGEN10) SBMJOB(*NO). |
QIJSCEC | BACKUP | |||
8/02/06 | 2:28:55 | IJS6003 | 50 | Job 268712/BACKUP/D_BU10 ended abnormally for job D_BU10 group D_BU10 sequence 01. |
QIJSLRUN | BACKUP |
Good luck!