Defining Repeating Jobs in Scheduler Job Management
search cancel

Defining Repeating Jobs in Scheduler Job Management

book

Article ID: 55767

calendar_today

Updated On:

Products

Scheduler Job Management

Issue/Introduction

Many sites have a need for a given job or job stream to execute over and over in a single day. Examples include batch processing of requests that have been entered, or monitoring for a certain condition, such as a file arriving from another system.

Traditionally, such repeating jobs have been handled by defining the job many times (96 times for a job that runs every 15 minutes!). Care had to be taken to prevent each job from starting before the previous iteration completed, and all of the jobs would appear in the active workload at Autoscan, making the operator's job harder.

Scheduler simplifies this process by allowing you to define jobs and schedules as repeating work.

Environment

Release: 11.0
Component: Scheduler Job Management

Resolution

Begin by defining the schedule and job normally. While editing the job, either scroll down to the repeat screen (it's the last screen in the job definition), or issue the REPEAT jump command on the command line.

To make this a repeating job, set the "Repeat" field to Yes.

Scheduler needs to know how long to wait before running the job again.  Enter a time, in HHMM format of 15, in the "Interval" field.

Scheduler also needs to know if the interval is to be added to the previous run's start or end time. For example, if you specify a 15 minute interval for a job that started at 9:00AM and ended at 9:04AM, should the next iteration start at 9:15AM or 9:19AM?  Enter START or END in the "From" field.

The last piece of information that Scheduler needs for a repeating job is when to stop repeating it.  You may specify a total number of repetitions, or a time at which Scheduler should stop repeating the job, or both. (The end time is specified in Scheduler's normal DDHHMM format.)

For example, this job should be repeated up to 25 times, but should not be repeated after 5:00PM (1700):

The display of the repeat screen should be:

 

------------------- CA SCHEDULER R11 (SCHD-SYSA) REPEAT ----------------------

COMMAND ===>                                                                 

Name . . . REPEAT     Number . . 01  Station . . 40  Schedule . . REPEAT       

Repeat:                                                                      

  Repeat  . . . . . . . YES                                                  

  Interval  . . . . . . 0015       From . . . START   (End/Start/Clock/XClock)

  Count . . . . . . . . 0025       (1-9999)                                  

  End Time  . . . . . . 001700   

 

Enter END to Exit, or UP for Previous Screen. 

 

Understanding how repeating jobs work is easiest by going through the above example. Suppose the job we just defined is brought in by Autoscan at 8:00AM. Assuming the job does not have an early start time or any predecessors, the job is immediately submitted.

Suppose that the job starts promptly at 8:00AM and ends successfully at 8:07AM.    Scheduler will issue an internal "RUN JOB" command to bring in another copy of the job. The new job will have an early start time of 8:15AM (the previous job's start time plus 15 minutes). The new job will also have a repeat count of 24, since it has already been repeated once.

You can see the current repeat values by displaying the job's status detail screens and scrolling to the repeat screen:

 

------------- CA SCHEDULER R11 (SCHD-SYSA) JOB STATUS DETAIL ----------------

COMMAND ===>                                                                

Job . . . . . REPEAT     Number . . 01  Station . . 40  Schedule . . REPEAT   

From Node . .                                                               

                                                                            

Repeat:                                                                     

  Repeat . . . . YES                                                        

  Interval . . . 0015             From . . . START   (End/Start/Clock/XClock)

  Count  . . . . 0024            (1-9999)                                  

  End Time . . . 2020/09/14   1700                                          

                                                                            

                                                    

Enter END to exit, or UP for previous screen.

                                

Notice that the repeat count is now 24, and that the end time has been resolved to a real date and time.

Suppose that the second occurrence of the job is submitted on time at 8:15AM, but doesn't actually start until 8:16AM due to a lack of initiators.  When the job successfully completes Scheduler will issue an internal "RUN JOB" to bring in the next copy of the job. This 3rd copy will have an early start time of 8:31AM not 8:30AM.  Remember that the repeat interval is added to the previous iteration's actual start or end time, not the submission time.  The repeat count is now 23.

Finally, consider the third occurrence of the job, which is submitted at 8:31AM and promptly abends.  The problem is not corrected until 9:10AM, at which time the RERUN command is issued to re-submit the job.  This copy of the job successfully completes at 9:17AM.    Scheduler issues the internal "RUN JOB" command, setting an early start time of 9:25AM -15 minutes after the last start of the job.  Scheduler does not run the "missed" iterations that would normally have executed around 8:45AM, 9:00AM, or 9:15AM.

Here are some important tips to remember about repeating jobs and schedules:

  • If you have a single job to be executed over and over, use the repeat at the job level. If you have two or more jobs that should run in order repeatedly, define the jobs to a schedule and use the repeat screen in the schedule definition. The repeat definition for schedules is the same as for jobs.
  • Jobs and schedules are repeated only when successfully complete.
  • "Missed" repetitions, such as in the example above, are not made up.
  • Jobs and schedules are not repeated if they are backlogged. Instead, the current execution is allowed to complete, then the work for the new day is brought into the active workload and executed.
  • If both a repeat count and a repeat end time are specified, Scheduler will stop repeating the job when the count is zero or the time is reached, whichever occurs first.
  • Scheduler repeats work by issuing an internal "RUN" command. This means that any changes made to the job or schedule definitions will be picked up on the next repetition.
  • The repeat count indicates the number of times the work is to be repeated-not the total number of times it will execute. For example, if the repeat count is 5, then the work will be repeated five times, for a total of six executions.

Using repeating jobs and schedules is an easy way to schedule work to run many times in the same day while reducing the complexity of your daily workload.