Operating System - OpenVMS
1757854 Members
2381 Online
108866 Solutions
New Discussion

Re: Submit After Question.

 
SOLVED
Go to solution
John Gillings
Honored Contributor

Re: Submit After Question.

As Hoff has pointed out, you can't rely on a job starting exactly AT the /AFTER time (that's why it's "/AFTER" not "/AT"). The only thing you can say for sure it it won't run BEFORE that time, though in a cluster with badly synchronized clocks, even that isn't necessarily a given!

An alternative to using /AFTER to schedule the time for a job is to let the job run "forever" in a loop with a WAIT calculated to delay until the next scheduled time. For your case, try:

$ mins="20" ! must be a numeric string
$ Loop: wait 'F$CVTIME(F$DELTA("",F$CVTIME(F$CVTIME("",,"HOUR")+":"+mins+":00+"+F$STRING(F$CVTIME("",,"MINUTE").GES.mins)+":0:0.0","ABSOLUTE")),,"TIME")
$ ! It is now 20 minutes past the hour
$ ! do your stuff
$ GOTO Loop

Depending on how accurate you need the time, I've sometimes found I need to add 100th of a second to the wait time (replace the string +":0:0.0" with +":0:0.01" to make sure it doesn't trigger just before the target time - truncation in DCL date arithmetic.

All this costs you is a process slot.

To prevent conflicts with other jobs, check out the SYNCHRONIZE command.
A crucible of informative mistakes