Announcement

Collapse
No announcement yet.

Automating job submission using WRKJOBSCDE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automating job submission using WRKJOBSCDE

    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

  • #2
    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.

    https://www.itjungle.com/2004/12/01/...s-immediately/

    Comment


    • #3
      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')
      (Obviously, you need to tweak some of the values... job name, program name, time.)

      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?

      Comment


      • #4
        Originally posted by Scott Klement View Post
        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')
        (Obviously, you need to tweak some of the values... job name, program name, time.)

        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?
        Actually, It hadn't occurred to me the fact that I could specify more than one day of the week on the same command. Further down the road this may get expanded to something like running every hour for 10 or 12 hours. I wonder if it would work to have a CHGJOBSCDE to the end of the program that would add 1 hr to SCDTIME, of course testing for the latest hour you want it to run. Then I would only need 1 command instead of 4. Just an idea

        Thanks for responding, both Scott and Ted

        Comment


        • #5
          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


          • #6
            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


            • #7
              I advise you to hire professional team software engineers https://mlsdev.com.

              Comment


              • #8
                Just a little arithmetic with time (or even hardcoding), and a job can be easily scheduled with SBMJOB with SCDTIME(&HHMM) parameter in a CL. I use this to run a job every 15 minutes, so that I just need to schedule it once in JOBSCDE.

                Comment


                • #9
                  I advise you to hire professional team software engineers from https://mlsdev.com

                  Comment

                  Working...
                  X