I have some jobs I need to submit 4 times a day, 2 hours apart, same time each day, Mon thru Friday. I would be calling the the same program each time. Is there a way this can be done using the IBM Job Scheduler (WRKJOBSCDE) without having to create 20 separate jobs on the scheduler
Announcement
Collapse
No announcement yet.
Automating job submission using WRKJOBSCDE
Collapse
X
-
Hi, Greg. When I had to do this sort of thing, I used a command I wrote that submits a job scheduler entry. You could build four job scheduler entries -- the first to run your program and the other three to run the first one. If you ever have to change the submitted command, you'll only change one job scheduler entry, not four.
You won't need 20 entries -- just make the four entries run Monday thru Friday.
The code for this article is available for download. You can buy better job schedulers than the one that comes bundled with OS/400. Unfortunately for many of us, the OS/400 job scheduler is the only one we’re permitted to use. Because I recently found myself forced to work within that restriction, I wrote a command
-
Seems to me you only need 4 entries. Yeah, its multiple entries, but... so what, you type one, press F9, adjust the time and press enter to add the second, F9 again, change the time, enter to add the third, etc.
Code:ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('09:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('11:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('13:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('15:00:00')
I don't think you need to create any special program or use a different scheduler, its not that bad to add 4 entries, is it?
- Likes 1
Comment
-
Originally posted by Scott Klement View PostSeems to me you only need 4 entries. Yeah, its multiple entries, but... so what, you type one, press F9, adjust the time and press enter to add the second, F9 again, change the time, enter to add the third, etc.
Code:ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('09:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('11:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('13:00:00') ADDJOBSCDE JOB(MYJOB) CMD(CALL PGM(MYPGM)) FRQ(*WEEKLY) SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI) SCDTIME('15:00:00')
I don't think you need to create any special program or use a different scheduler, its not that bad to add 4 entries, is it?
Thanks for responding, both Scott and Ted
Comment
-
An alternative to the job schedular could be a small modification to the program. Is it possible to change the program to do its process, then issue a DLYJOB RSMTIME(x) and loop back to the beginning? The resume time could be read from a file to make changes easy. Or could you make a CL wrapper that did a small loop to call your program and issue the delay?
Comment
-
I've done this with jobs that needed to run every 1/2 hour, 20 hours a day, on weekdays. That requires 40 job schedule entries, and it was easy enough to add them all with ADDJOBSCDE. You can also prevent them all from running by HLDJOBSCDE JOB(MYJOB*) and release them with the equivalent RLSJOBSCDE command. I wouldn't bother trying to use CHGJOBSCDE in the program -- if you're going to do that, you may as well avoid the job scheduler entirely and just use DLYJOB. Adding separate entries is easier to manage and support, imho. When one of them fails, the next one will still run (a crashed program won't prevent the CHGJOBSCDE command from running). People can choose to hold/release certain entries when needed. It works very nicely.
Comment
Comment