Examples: Making SYNCVAL work for you

SYNCVAL={hh:mm|*:mm) sounds more complex than it is. This section will go into a bunch of detail about how it works, but don't let all this verbiage scare you - in the end, SYNCVAL just lets you establish a synchronization point so that you can predict and control when a check is scheduled to run.

Note that in the examples below, we talk about coordinating with INTERVAL. But all this information also applies to EXCEPTINTERVAL.

Example 1 - I want exact run times for my check: Lets say we've got a check, CHECKA. Because we like to do things the best and most efficient way, we set up a nice policy statement for CHECKA for our HZSPRMxx parmlib member so that the way we want the check to run is preserved in perpetuity. We need this check to run at synchronized predictable intervals, so we have the following list of assumptions for our CHECKA:
  • CHECKA has a runtime of 1 minute.
  • We want CHECKA to every 30 minutes.
  • We want CHECKA to run at predictable, synchronized times, starting at 12:00 noon.
To make this happen, we will specify a policy statement that combines the INTERVAL we want with the SYNCVAL start point that provides the point of synchronization for predictable run times:
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
           UPDATE CHECK(CHECKOWNERA,CHECKA)
           SYNCVAL(12:00) INTERVAL(00:30) 
           REASON('Synchronize CHECKA run time')
           DATE(20110112)

Once this policy takes effect, the system schedules the check to run at 12:00 and every 30 minutes thereafter, at exactly 12:30, 1:00, 1:30 and so on. If you already have CHECKA defined and running on the system when you set up a policy statement with SYNCVAL for it, you have to refresh your check in order for the initial SYNCVAL start time take effect. However, note that if you add CHECKA in the future, it is synchronized to 15,30,45, and 0 minutes after the hour, even without a REFRESH.

Now, just for fun, we'll add EXCEPTINTERVAL(HALF) to the ADDREPLACE policy:
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
           UPDATE CHECK(CHECKOWNERA,CHECKA)
           SYNCVAL(12:00) INTERVAL(00:15) 
           EXCEPTINTERVAL(HALF) 
           REASON('Synchronize CHECKA run time')
           DATE(20110112)

Once this policy takes effect, if the check finds an exception the interval time is halved, so that the system schedules the check to run at 12:00 and every 15 minutes thereafter, at exactly 12:15, 12:30, 12:45 and so on.

Example 2 - I want my check to run at a specific time every day: I want to run CHECKB once a day at midnight (00:00) so it's not interfering with any other applications (not that a check typically makes much performance impact). Here's a policy statement that will make that happen:
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
           UPDATE CHECK(CHECKOWNERB,CHECKB)
           SYNCVAL(00:00) INTERVAL(24:00) 
           REASON('Make CHECKB run at midnight')
           DATE(20110112)
Now, when the policy takes effect, the check is scheduled to run once a day exactly at midnight.
Example 3 - I want my check to run at the same minute of the hour, every time it does run: I just want to be able to predict that CHECKC will only run at 15 minutes past the hour when it runs (for example, because my system has other work scheduled every hour) at the top of the hour. I want CHECKB to run every 6 hours, but at 15 minutes past the hour. Here's my statement:
ADDREPLACE POLICY(policyname) STMT(GLOBAL)
           UPDATE CHECK(CHECKOWNERC,CHECKC)
           SYNCVAL(*:15) INTERVAL(06:00)
           REASON('Make CHECKC run at 15 minutes after the hour')
           DATE(20110112)
That works. But look out for the gotchas; SYNCVAL and INTERVAL have to synch up, if you will. For example, SYNCVAL(*:15) INTERVAL(06:00) will work. But SYNCVAL(*:15) INTERVAL(00:18) will not work - you're asking the system to run CHECKC every 18 minutes at 15 minutes after the hour. SeeSYNCVAL restrictions