Hi,
i want to add a job that will run a particular command on houly basis.
I would prefer WRKJOBSCDE ( i know) but here schedule time parameter has no "for more values".
Can any one tell me what shall i do to add a job to run in hourly basis.
Thanks,
Siddharth
Software/Hardware used:
ASKED:
April 9, 2009 7:01 AM
UPDATED:
April 14, 2009 3:07 PM
I would just copy the job schedule entry 23 times and change the times.
We use the technique recommended by Martin GIlbert – works great.
If you need the job to run at a specific time, such as 15 minutes after the hour, use this format:
DLYJOB RSMTIME(‘HHMMSS’) to tell your program exactly when to re-start. You will have to add a little code to your program to reconstruct the HHMMSS value before issuing DLYJOB. The system automatically knows the correct date by inspecting the time. If resume time is less than current time, the job resumes at that time on the following day.
Seems like you could write a cl program that would do your hourly function and then, based on the time, add a one time job schedule entry (addjobscde) for the next hour to run the cl again. Seems to work from this little test that I put together:
PGM
DCL Var(&HR) Type(*DEC) Len(2 0) /**Numeric Hour**/
DCL Var(&HRA) Type(*CHAR) Len(2) /**Alpha Hour**/
DCL Var(&NEWTIME) Type(*CHAR) Len(8) /**New submit time **/
RTVSYSVAL SYSVAL(QHOUR) RTNVAR(&HRA)
CALL HOURJOB
CHGVAR VAR(&HR) VALUE(&HRA)
CHGVAR VAR(&HR) VALUE(&HR + 1)
CHGVAR VAR(&HRA) VALUE(&HR)
CHGVAR VAR(&NEWTIME) VALUE(&HRA || ’0000′)
ADDJOBSCDE JOB(TEST) CMD(CALL PGM(libray/thisprogram)) +
FRQ(*ONCE) SCDTIME(&NEWTIME)
ENDPGM
Of course, you will need to add logic for when you get into a new day, etc.
Hi
I have done the coding part, but not so sure about the job scheduling entries. Code is like this:
PGM
LOOP:
DSPSYSSTS OUTPUT(*PRINT) /* DISPLAYING SYSTEM STATUS */
DLYJOB DLY(3600) /* DELAYING JOB */
GOTO CMDLBL(LOOP)
ENDPGM
But after adding this program in ADDJOBSCDE the next submission date appears to be the next day,
i am not getting this thing. Any one can shed some light??
Thanks in advance
Sangay,
This doesn’t reschedule the job. What it does is keep the first job running. It does the DSPSYSSTS then waits one hour, then runs DSPSYSSTS again. No job schedule entries are required. Normally these jobs run in batch without a display. I prefer this:
PGM
LOOP:
SBMJOB (your hourly job specs)
DLYJOB DLY(3600) /* DELAYING JOB */
GOTO CMDLBL(LOOP)
ENDPGM
That way the hourly job runs on its own job, and this avoids file locking issues, etc (of course, this depends on what the job does).
If you always want the job running, you can add an autostart entry to a batch subsystem. That way, every time your system IPLs the job will automatically start and keep running every hour. This technique does not require a job schedule entry.
We have a group of jobs that function exactly like this. We cloned the QBATCH subsystem as “AUTOSTART” and added our autostart entries there. This keeps QBATCH clean for your users.
If using the QDELAY approach, you need to run it in a job que that allows multiple jobs to run at a time since this job will always be active and will never release it’s spot in the subsystem. (Unless this is the only job that is going to run in this que.) If the job que has maximum active set to 1 and you submit other jobs to it after starting this one, they will not run. They will be stuck in the que until this job is ended.
We set up a subsystem called QDELAY with a job que with the same name that we use for these delay jobs so that they don’t interfere with other jobs on the system. We set the maximum active for the job que to 8 since we currently only have 7 delay jobs active.
As WoodEngineer stated, you will need to set this up as an autostart job on the subsystem or add a submit for it in QSTRUP.
I still prefer using multiple job schedule entries. Keeping the job in delay means it is still holding all of its resource overhead. This can be a lot of needless storage depending on the job.
Hi BigKat,
If you’re going to use multiple schedule entries, I’d suggest putting the ADDJOBSCDE commands in a CL source file, with RMVJOBSCDE commands, so you can easily maintain the jobs later.
Just an idea.
Regards,
Martin Gilbert.