On 16-Dec-2014 20:03 -0600, Rick Mason wrote:
I have a program that is currently submitted 3 times daily via the
job scheduler.
The manager is now requesting the job be run every hour between the
hours of 5am and 11pm.
What would be the more efficient way to accomplish this other than
creating way too many job scheduled entries for the same job.
  Given the current situation is that there exist three job schedule 
entries for processing the command invocation RUNSTUFF, a CLP could be 
created that makes that same command request.  If the request to 
RUNSTUFF is sure to be started [somewhat] promptly on an hour and sure 
to be completed easily under\within that same hour, then that request in 
the CLP could be surrounded by some additional command requests that 
cause the request to be re-requested hourly over that time-period.  The 
original three separate job schedule entries would be replaced with just 
the one JSE requesting a CALL of the new CLP.  That CALL could be 
scheduled to start at any hour prior to the first time [at 05am] that 
the request should run in the given day.
    ADDJOBSCDE CMD(CALL theNewCLP) SCDTIME(0315) FRQ(*WEEKLY) 
SCDDATE(*NONE) SCDDAY(*ALL) ...
  The [new CL] program could be coded such that, if at any time during 
a day the job is first started, even if after the official start-time of 
05am, the CLP will at the /next hour/ [not exceeding the end-hour] 
re-invoke the CLP as a new routing step; running the request within a 
new routing step of the same job is _more efficient_ than starting a new 
[batch] job.  The following code is untested [and each command should be 
examined for completeness; the Transfer Batch Job (TFRBCHJOB) request is 
coded with ellipses where values should be retrieved or hard-coded], but 
the logic should be sound:
    PGM
       /* effective constants follow: */
       dcl &str_hour   *dec (02 00) value(05) /* 05:00 */
       dcl &end_hour   *dec (02 00) value(23) /* 23:00 */
       /* program variables follow:   */
       dcl &hour       *char 02
       dcl &dec_hour   *dec (02 00)
       dcl &next_hour  *char 04     value('HH00')
    MainLine:
     CALLSUBR CalcNxtHr    /* determine next time to run today */
     IF COND(&NEXT_HOUR *EQ '*END') THEN(GOTO FinalRqs)
     DLYJOB RSMTIME(&NEXT_HOUR) /* await str_hour or next hour */
    Repeatedly: /* perform the hourly request; 05.0 to 23.0 */
     RUNSTUFF  /* Perform what was originally a JSE request */
     TFRBCHJOB RQSDTA('CALL TheNewCLP') /* re-invoke theNewCLP */+
         JOBQ(...) RTGDTA(...) /* assign appropriate WrkMgmt */
    FinalRqs:
     RETURN
    /* SubRoutines follow: */
     SUBR CalcNxtHr
      rtvsysval qhour &hour
      chgvar &dec_hour  &hour
      chgvar &dec_hour (&dec_hour + 1)
      if cond(&dec_hour *gt &end_hour) then(do)
        chgvar &next_hour '*END'  /* beyond last-run HH  */
      enddo
      else do /* incremented hour between str and end HH */
        if cond(&dec_hour *le &str_hour) /* before 1st-run HH */+
           then(chgvar &dec_hour &str_hour) /* set 1st-run HH */
        chgvar %sst(&next_hour 1 2) &dec_hour
      enddo
      ENDSUBR
    /* SubRoutines above: */
    ENDPGM
As an Amazon Associate we earn from qualifying purchases.