IBM i QuickTip: Running Robot/Schedule Jobs on an Irregular Schedule

Like many IBM i shops, we use Help/Systems’ Robot/SCHEDULE software to automatically submit batch jobs and run batch job streams on a regular basis. We recently discovered a valuable SCHEDULE parameter that allows us to configure jobs to run on a more irregular schedule, letting us set up job streams for dates that can’t be scheduled on a weekly basis or by reacting to other job completions. This parameter allows us to schedule jobs on a regular basis for such hard to set up requirements as:

  • Jobs that must run on the same day each month, such as on the 7th, 14th, 21st, and the 28th days of each month
  • Jobs that must always run on the last day of the month, regardless of whether the last day falls on the 31st, 30th, 29th, or 28th of the month
  • Jobs that must always run a set number of days before month end, such as a job that needs to run one week or two weeks before month-end

We found that you can set up these schedules by using the Day Number (DAYNO) parameter in SCHEDULE’s Advanced Scheduling screen. DAYNO allows jobs to run on specific or relative calendar days of the month. With DAYNO, you can easily set up jobs to satisfy the situations listed here, as I’ll show you in the next few paragraphs.

Here’s how to use the Advanced Scheduling screen to set up a job that must always run on the 7th, 14th, 21st, and 28th of each month.

To run this schedule, I left all other scheduling parameters blank on the SCHEDULE Initial Job Setup screen and the Exception Scheduling screen. I opened the Advanced Scheduling feature for my Robot/SCHEDULE entry (2=Advanced Scheduling off the Job Schedule List), put a ‘1’ in front of the DAYNO parameter, and I also placed a ‘1’ in front of the Calendar field on the line under the DAYNO parameter. The calendar field tells SCHEDULE to run this job only on specific calendar days. I then put the calendar days ‘7’, ’14’, ’21’, and ’28’ into the Run on these day numbers fields, and my job is now set up to run on the 7th, 14th, 21st, and 28th days of each month.

That’s easy enough, but what if I want to run the job only on the last day of the month, which can be either the 31st, 30th, 29th, or 28th, depending on what month it is and whether we’re in a leap year. To do that, I would change my entry’s Advanced Scheduling screen to look like the following:

 In the first example, I used positive numbers to designate a run date that was x days after the beginning of the month (think of the first day of the month as 0 and add the day numbers to it). In this entry, I use a negative number to designate a run date that is x number of days before the beginning of each month. Since I put in a -1 in the Run on these day numbers field, this job will now run on the first day before the beginning of a new month (ie, the last day of the month is the beginning month date zero minus 1). It doesn’t matter how many days the month has in it, this job will always run on that last day of the month because it is one day before the beginning of the new month (-1).

This last screen shows how to schedule a job to run two weeks (14 days) before the beginning of the next month.

Similar to the previous example, this job will always kick off two weeks before the beginning of new month (-14 days). Once you get the idea that you use positive numbers to kick jobs off on specific days of the month and negative numbers to kick them off on specific days before the beginning of the next month, it becomes very easy to schedule Robot jobs to run on irregular dates during a month.

So if you haven’t tried it, the DAYNO parameter is a fairly worthwhile SCHEDULE feature that allows you to schedule jobs on specific or relative calendar days of a month. There are some other interesting Robot/SCHEDULE features you can use to set up a more flexible run schedule for your entries, but I’ll leave you to explore them for yourself.

**************************************************

Follow Joe Hertvik on Twitter @JoeHertvik. You can also add Joe to your professional network on LinkedIn by clicking here.

About Joe Hertvik

Joe is the owner of Hertvik Business Services, a service company providing written white papers, case studies, and other marketing content to computer industry companies. He is also a contributing editor for IT Jungle and has written the Admin Alert column for the past ten years. Follow Joe Hertvik on Twitter @JoeHertvik. Email Joe for a free quote on white papers, case studies, brochures, or other marketing materials.
This entry was posted in IBM i Tech Info. Bookmark the permalink.