ADRULE
Purpose
Use the ADRULE control statement to specify a rule, which generates a set of dates. The ADRULE control statement must immediately follow an ADRUN or RGRUN statement. If you have many rules, use a pair of ADRUN/ADRULE statements for each one. In run cycle groups, you must use pairs of RGRUN/ADRULE statements.
Format
Restrictions
You cannot use ACTION(SETDEFAULT) to set default values for this control statement.
Parameters
- DAY (DAY | WORKDAY | FREEDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY | SUNDAY)
- Specifies the day or days. You can abbreviate the names of the days to MON TUE WED THU FRI SAT SUN WORK and FREE.
- EVERY | ONLY
- Use
EVERY to specify a series of days. For example, EVERY(2) DAY(DAY)
FEBRUARY specifies days 1, 3, 5, 7 etc. in February. The origin of
the series is 1 unless you also specify ORIGINSHIFT.
Use ONLY to specify the days precisely. For example, ONLY(2) DAY(DAY) FEBRUARY specifies only February 2.
- (day number)
- Specifies the number (for ONLY) of the day or days to be selected. For EVERY, this specifies the interval of the series. The number is in the range 1 to 999.
- LAST (day number)
- Specifies
the number (for ONLY)
of the day or days to be selected. For LAST(3), read
third last,
so ONLY LAST(3) DAY(DAY) JANUARY specifies JANUARY 29.For EVERY, this specifies the interval of the series, starting from the end, so EVERY LAST(3) DAY(DAY) JANUARY specifies January 31, 28, 25 etc. The origin of the series is the last day unless you also specify ORIGINSHIFT. The number is in the range 1 to 999.
- MONTH (JANUARY | FEBRUARY | MARCH | APRIL | MAY | JUNE | JULY | AUGUST | SEPTEMBER | OCTOBER | NOVEMBER | DECEMBER)
- Specifies the month or months. You can abbreviate the names of the months to the first three characters. If you omit the name of the month, the rule selects every month.
- ORIGINSHIFT (number)
- Specifies the origin shift in days. The number is in the range 1 to 999. Use this only with the EVERY keyword, when the origin is not the first (or, with LAST, the last) day of the cycle or period. If you specify EVERY(4) DAY(DAY) MONTH ORIGINSHIFT(1), for example, the rule selects a series starting at the second day of each month, with an interval of 4 days: January 2, 6, 10 etc., then February 2, 6, 10 etc., for each month in the year.
- PERIOD (period name)
- The name of a user-defined period, which must be in the period database. If you specify a period name such as JULY, which is the same name as a predefined cycle, IBM Z Workload Scheduler looks for a user-defined period JULY, and gives an error if one does not exist.
- WEEK (week number)
- Specifies the week number or numbers. The number might range from 1 to 53. Week 1 is defined as the first week with at least 4 days of the new year. If you omit the number, the rule selects every week.
- YEAR
- Used to specify that the cycle is a year, as in EVERY(2) DAY(DAY) YEAR, which gives January 1, January 3, January 5 etc. for each year. ONLY LAST DAY(FRIDAY) YEAR gives the last Friday in each year.
Examples
In the following example, EX1A (type R) selects the fourth Thursday in each month, or the closest work day before, if the Thursday is a free day (free-day rule 1). EX1B (type E) excludes the last Thursday of the year. Note that the exclusion rule has exactly the same input-arrival time and free-day rule as EX1A:
ADRUN NAME(EX1A) TYPE(R) RULE(1) IATIME(1800) DLTIME(2300)
ADRULE ONLY(4) DAY(THU) MONTH
ADRUN NAME(EX1B) TYPE(E) RULE(1) IATIME(1800) DLTIME(2300)
ADRULE ONLY LAST DAY(THU) YEAR
In the next example, EX2A (type R) selects February 3 and February 5, whether or not these are free days (rule 3). EX2B (type R) selects March 8, whether or not this is a free day (rule 3). The total effect of the two rules is to select these three days each year:
ADRUN NAME(EX2A) TYPE(R) RULE(3) IATIME(1800) DLTIME(2300)
ADRULE ONLY(3,5) DAY(DAY) MONTH(FEB)
ADRUN NAME(EX2B) TYPE(R) RULE(3) IATIME(1800) DLTIME(2300)
ADRULE ONLY(8) DAY(DAY) MONTH(MARCH)
EX3A (type R) is a complex rule which is a result of two series. EVERY(2) DAY(DAY) YEAR specifies January 1, 3, 5, 7, 9 etc., and EVERY(3) DAY(DAY) YEAR specifies January 1, 4, 7, 10, 13 etc. IBM Z Workload Scheduler adds these two series and removes the duplicates, creating this series: January 1, 3, 4, 5, 7, 9, 10, 13 etc. It then ignores any days that are free days (free-day rule 4):
ADRUN NAME(EX3A) TYPE(R) RULE(4) IATIME(1800) DLTIME(2300)
ADRULE EVERY(2,3) DAY(DAY) YEAR
EX4A (type R) specifies every Monday, even if Monday is a free day. Be careful with the work day end time defined in the calendar, because the input arrival time is early (01.00). If the work day end time is 01.00 or later, this rule will cause the application to be scheduled early on Tuesday morning, because times up to the work day end time are considered part of the previous day:
ADRUN NAME(EX4A) TYPE(R) RULE(3) IATIME(0100) DLTIME(2300)
ADRULE EVERY DAY(MONDAY) YEAR
EX5A (type R) specifies every week day (Monday to Friday), even if a free day. EX5B (type E) excludes all work days. The result is to select all week days that are free days:
ADRUN NAME(EX5A) TYPE(R) RULE(3) IATIME(0800) DLTIME(2300)
ADRULE EVERY DAY(MON,TUE,WED,THU,FRI)
YEAR
ADRUN NAME(EX5B) TYPE(E) RULE(3) IATIME(0800) DLTIME(2300)
ADRULE EVERY DAY(WORK) YEAR
In the following example, EX6A (type R) specifies the first free day in each week and the first free day in each year, because ONLY without a number is equivalent to ONLY(1). This is really a combination of two simple rules: ONLY(1) DAY(FREEDAY) WEEK and ONLY(1) DAY(FREEDAY) YEAR. The days generated are also affected by the free day rule, so you normally use rule 3 (select the free day) with FREEDAY. If EX6A had specified free-day rule 1 (closest work day before), for example, IBM Z Workload Scheduler would have generated the closest work day before the first free day in each week and the first free day in the year.
ADRUN NAME(EX6A) TYPE(R) RULE(3) IATIME(0800) DLTIME(2300)
ADRULE ONLY DAY(FREE) WEEK YEAR
ADRUN NAME(EX6A)TYPE(R)RULE(3)IATIME(0800)DLTIME(2300)
ADRULE ONLY(1)DAY(FREE)WEEK
ADRUN NAME(EX6B)TYPE(R)RULE(3)IATIME(0800)DLTIME(2300)
ADRULE ONLY(1)DAY(FREE)YEAR
RGRUN NAME(EX7A)TYPE(R)RULE(3)IATIME(0800)DLTIME(2300)
ADRULE ONLY(29)DAY(DAY)MONTH(FEB)
RGRUN NAME(EX8A) TYPE(R) RULE(1) IATIME(0800) DLTIME(2300)
ADRULE O D(DAY) W(4) Y /* USING KEYWORD ABBREVIATIONS */