How to schedule a specific day-of-month to a specific day-of-week

Document ID : KB000027232
Last Modified Date : 14/02/2018
Show Technical Document Details

Question:

How can do you define a schedule for a specific day-of-month to a specific day-of-week?

Answer:

This article discusses how to schedule a job that has to run on a specific day-of-the-week only if it is a specific day-of-the-month.

To schedule a day-of-week to a day-of-month requires evaluation of the day-of-month and its relationship to the day-of-week. First, determine which occurrence for the day-of-month could be for the day-of-week. Then schedule the job monthly for that week and day-of-week and remove all days you would not want the job to execute during that week.

For example: Schedule a job for Sunday only if Sunday is the 7 th of the month.

First, you know if Sunday is the 7th of the month, has to be the first Sunday of the month-then the question is: what could the first Sunday of the month be and not be the 7th?--It could be the 1 st, 2 nd, 3 rd, 4 th, 5 th, or 6 th. You schedule that as:

 __X__ MONTHLY JAN:X FEB:X MAR:X APR:X MAY:X JUN:X 
 JUL:X AUG:X SEP:X OCT:X NOV:X DEC:X
 WEEK:1 DAY-OF-WEEK:SUN 
 RDAY:/1,/2,/3,/4,/5,/6 

The calendar for this schedule should have 7 days of the week available and have the SCHDYONLY option of N.

Another example: Schedule a job for the 15 th of the month only if it is a Wednesday.

 __X__ MONTHLY JAN:X FEB:X MAR:X APR:X MAY:X JUN:X 
 JUL:X AUG:X SEP:X OCT:X NOV:X DEC:X 
 WEEK:1 DAY-OF-WEEK:WED 
 RDAY:/16,/17,/18,/19,/20,/21

Additional Information:

As always, please contact CA Technologies support for CA 7 if you have further questions.