|
|
![]() |
|
|
|
|
||
|
Scheduling a Job to Run More than Once a Day Hey, Ted: How can I schedule a job to run more than once a day? The Add Job Schedule Entry (ADDJOBSCDE) command has only the frequency options of *monthly, *weekly, *once.
-- Rocky One option is to install IBM's licensed program product 5722-JS1 (Job Scheduler for iSeries) and use the Add Job using Job Scheduler (ADDJOBJS) command. If I am not mistaken, IBM charges extra for this job scheduler. If you want to use ADDJOBSCDE instead, write a CL program to schedule the jobs throughout the day. Let the job scheduler execute your CL program. For example, assume you want to run a job on the hour from 7:00 AM to 5:00 PM (0700 to 1700 hours), Monday through Friday. Your CL program, which I'll call SKEDPGM, looks something like this:
PGM
DCL &SKEDTIME *CHAR 4
DCL &TIME *DEC 4
DCL &BEGTIME *DEC 4 VALUE(0700)
DCL &ENDTIME *DEC 4 VALUE(1700)
DCL &INCREMENT *DEC 4 VALUE(0100)
MONMSG CPF0000 EXEC(GOTO ERROR)
CHGVAR &TIME &BEGTIME
NEXTSKED:
CHGVAR &SKEDTIME &TIME
SBMJOB CMD(CALL SOMEPGM) +
JOB(SOMEJOB) +
SCDTIME(&SKEDTIME)
IF (&TIME *LT &ENDTIME) DO
CHGVAR &TIME (&TIME + &INCREMENT)
GOTO NEXTSKED
ENDDO
RETURN
ERROR:
/* DO WHATEVER */
ENDPGM
Notice the SCDTIME parameter on the Submit Job (SBMJOB) command. This schedules the job to run at a later time. Notice also that the expression that increments the &TIME variable is decimal arithmetic, not time arithmetic. If you are scheduling a job to run every ten minutes, for example, you will have to increment the hour and reset minutes to zero when minutes reaches a value of 60. Have the job scheduler run this program before 7:00 AM:
ADDJOBSCDE JOB(MYJOB) +
CMD(CALL PGM(SKEDPGM)) +
FRQ(*WEEKLY) +
SCDDATE(*NONE) +
SCDDAY(*MON *TUE *WED *THU *FRI) +
SCDTIME(003000)
-- Ted
|
Editors
Contact the Editors |
|
Last Updated: 7/12/02 Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved. |