Run cycle group

You can optionally define a run cycle group for your job stream instead of, or in addition to, a number of single run cycles.

A run cycle group is a list of run cycles that are combined together to produce a set of run dates.

By using run cycle groups, you can benefit from the following advantages:
A run cycle group is a distinct database object
It is defined by itself and can be matched with one or more job streams. It is not defined as part of a specific job stream like single run cycles.
The same run cycle group can be used on different job streams
This improves the overall usability of the run cycles, because you can specify the same run cycle group in multiple job streams, avoiding the need to have multiple run cycle definitions for the same scheduling rules.
Run cycle groups enhance the use of exclusive run cycles
Exclusive (or negative) run cycles are used to generate negative occurrences, which identify the days when a job stream would normally be scheduled but is not required. The sum of the exclusive run cycles are subtracted from the inclusive ones. A negative occurrence always cancels any matching positive occurrences and you can specify a negative occurrence only if the positive equivalent already exists. An exact matching of the days, as well as any time restrictions, is required between the exclusive and inclusive run cycles for the cancellation to occur. Run cycle groups add much flexibility by allowing users to apply exclusive run cycles to a subset of the positive ones rather than to all of them. Group your run cycles into subsets so that the exclusive run cycles can be applied only to the positive occurrences generated by the run cycles belonging to the same set.

Run cycles must be organized into subsets within a run cycle group. The subsets are always in a logical OR relationship with each other. The result of the run cycle group is always a date or set of dates; it cannot be negative.

For example, you might want your job stream to run every day of the month except the last day of the month. But, you also want the it to be scheduled on the last day of the year (the last day of December). You can define a run cycle group using subsets, as follows:
Subset 1
  • Run cycle 1 - Inclusive run cycle every day of the month
  • Run cycle 2 - Exclusive run cycle on the last day of the month
Subset 2
  • Run cycle 3 - Inclusive run cycle on December 31st
where, run cycle 2 cancels the last day of each month in Subset 1, while run cycle 3 generates December 31st as a separate date and therefore you can schedule the job stream on Dec 31st.
Run cycle groups allow the use of a logical AND between individual run cycles in the subset
By default, the run cycles within a subset are in a logical OR relationship but you can change this to a logical AND, if the run cycle group result is a positive date or set of dates (Inclusive). For each run cycle, you can specify either operator (AND ,OR), obtaining the following behavior:  
  1. All the run cycles of the group that are in AND relationship are calculated first. The result of this calculation is a date or a set of dates.
  2. Then, all the run cycles in an OR relationship are added to the result of the previous step.

A similar behavior is applied to inclusive and exclusive run cycles to determine the final date or set of dates of a group.

Inclusive (A)
Rule-based run cycle. Select days when the job stream is to be run if they belong to all A types of the set of run cycles.
Exclusive (D)
Exclusion rule-based run cycle. Select days when the job stream is NOT to be run if they belong to all D types of the set of run cycles.
For example, you can add two conditions together:
Run on Wednesday “AND” the 8th workday of the month. 
In this way, the only scheduled dates are any 8th work day of the month that falls on a Wednesday.
Full compatibility with traditional run cycles
The traditional run cycles specified in the job stream definition can reference run cycle groups, with the possibility to specify shift or offsets on them (as with periods for z/OS or calendars for distributed systems).
A set of dates (interval starts) is created automatically either at run cycle level directly (inclusively or exclusively with offsets, or in the rule. This is a two-step process with run cycles:
  1. Define the key "business event", such as, Month End, using run cycles and free day rules
  2. Define rules that use the dates of the "business event" as the intervals against which the other batch run can be scheduled relative to.
For example, you have a Month End process that runs on the Last Friday of a month, but that moves forward to the next working day, except in December when it runs on the 3rd Friday of the month. This scheduling rule can be defined with a few rules, run cycles, and free day rules.

Two working days before Month End you need to run a pre-validation process to allow problems to be addressed before the run. You cannot choose the last Wednesday of the month, because in some months this might occur after the last Friday. Similarly, if the last Friday was a free day, the last Wednesday will not be 2 working days before it, because the Free Day rule applies ONLY to the day the rule falls on, it cannot look at anything else.

Many other batch runs might also need to be run on a certain number of days before or after the Month End, but the same restrictions apply.

You can now define work to run relative to something defined by a combination of run cycles and free day rules.

Use of calendars with run cycles within a run cycle group

Optionally, you can specify more than one calendar to calculate the working and non-working days definition for a run cycle. The primary calendar is used to calculate which working days are valid, and a secondary calendar is used to calculate specific non-working dates. If the dates calculated according to the secondary calendar match with the working days in the primary calendar, the job is scheduled; if they do not match, the job is not scheduled.

For example, a global company that runs workload in the United States for many other countries needs many calendar combinations to ensure that the batch jobs only run on a day that is a working day both in the United States and the other country. The calendar can be defined at job stream level and, if not specified, a default calendar is used. However, the calendar at run cycle level, whenever defined, can be used as secondary calendar and the job stream (or default) calendar can be used as the primary calendar.

For example, Primary calendar can be WORKDAYS, which is defined as MONDAY to FRIDAY excluding US holiday dates. You might also need to calculate the job runs based on calendar HKWORK, which is defined as Monday to Friday excluding Hong Kong holiday dates. The job might have several schedules:
  • Run on working days, but not the last working day and not Mondays
  • Run on Mondays, but not on the last working day
  • Run on the last working day
Because each schedule is calculated against the WORKHK calendar it is also checked against the WORKDAYS calendar to ensure that it is scheduled on a US working day.
The use of time restrictions with run cycle groups
You can specify time constraints to define the time when processing must start or the time after which processing must no longer start. To do this, you can associate time restrictions to job, job streams, run cycles, and run cycle groups. When you define a time restriction, you basically obtain a time. Because you can associate time restrictions to multiple objects, the following hierarchy shows the order by which the different time restrictions are taken into consideration to actually define when to start the processing:
  1. Time restriction defined in the run cycle into the job stream
  2. Time restriction defined in the job stream
  3. Time restriction defined in the run cycle contained in the run cycle group associated to the job stream.
  4. Time restriction defined in the run cycle group associated to the job stream.
  5. Start of Day
This means that:
Time restrictions in the job stream
Override and take precedence over any other time restrictions defined in the run cycles or run cycle groups associated to the job stream.
No time restrictions in the job stream nor in the run cycle group
The group generates only a date that is the Start Of Day. If offsets and free day rules are to be calculated, the calculation always starts from the Start Of Day.
Time restrictions in the run cycle group (not in the job stream)
Time restrictions (and possible offset) are calculated starting from the Start Of Day and the resulting date and time indicate the start of processing.

Examples

Table 1. Scenario 1. No time restriction in the run cycle group
Run cycle group Scheduled date Earliest Start
Run cycle group 10/24 10/24
Run cycle group with offset (+ 3 days) 10/27 (Saturday) 10/27/ (Saturday)
Run cycle group with free day rule 10/29/ (Monday) 0/29/ (Monday)
     
Run cycle in the job stream with time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with free day rule 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with earliest start +1 1pm 11/02 (Friday) 11/03 (Saturday) 1pm
     
Run cycle in the job stream without time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/02 (Friday) Start of Day
Run cycle in the job stream with free day rule 11/02 (Friday) 11/02 (Friday) Start of Day
Table 2. Scenario 2. Time restriction in the run cycle group without offset
Run cycle group Scheduled date Earliest Start
Run cycle group 10/24 10/24
Run cycle group with calendar offset (+ 3 days) 10/27/ (Saturday) 10/27/ (Saturday)
Run cycle group with free day rule 10/29/ (Monday) 0/29/ (Monday)
     
Run cycle in the job stream with time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with free day rule 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with earliest start +1 1pm 11/02 (Friday) 11/03 (Saturday) 1pm
     
Run cycle in the job stream without time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/02 (Friday) Start of Day
Run cycle in the job stream with free day rule 11/02 (Friday) 11/02 (Friday) Start of Day
Table 3. Scenario 3. Time restriction in the run cycle group with offset (+1 12:00)
Run cycle group Scheduled date Earliest Start
Run cycle group 10/24 10/24
Run cycle group with calendar offset (+ 3 days) 10/27/ (Saturday) 10/27/ (Saturday)
Run cycle group with free day rule 10/29/ (Monday) 10/29/ (Monday)
Run cycle group with offset +1 12:00 10/29/ (Monday) 10/30 12:00 (Tuesday)
     
Run cycle in the job stream with time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with free day rule 11/02 (Friday) 11/02 (Friday)
Run cycle in the job stream with earliest start +1 1pm 11/02 (Friday) 11/03 (Saturday) 1pm
     
Run cycle in the job stream without time restrictions    
Run cycle in the job stream with + 4 working days shift 11/02 (Friday) 11/03 12:00 (Saturday)
Run cycle in the job stream with free day rule 11/02 (Friday) 11/03 12:00 (Saturday)
Availability of the GENDAYS command at run cycle group level
Using GENDAYS, you can check the result of the combination of all the run cycles in the group.