HP OpenVMS Systemsask the wizard |
The Question is: I need to know how to get the SUBMIT/AFTER command to submit a job to a batch queue every 7 days (ie. it will execute at 7:00am every Friday morning). I have played around with both absolute and delta time (and also trying to combine them) with little success. Any assistance would be greatly appreciated. William R. Mangan, Jr. Network Engineer Shared Medical Systems/Outsourcing Division Children's Hospital of Pittsburgh 3705 Fifth Avenue Pittsburgh PA, 15213 412-692-7269 The Answer is : The simplest way to resubmit a periodic job is to use a combination time. For example: $ SUBMIT/AFTER="+7-" This will resubmit the job exactly 7 days after the current time. The only drawback is the time the job executes will tend to drift forward, especially if you wait until the end of the procedure to resubmit the job. If you really want 7 days from now at 7 am, you can use some DCL to derive the absolute time string: $ day=F$CVTIME("+7-","ABSOLUTE","DATE") $ SUBMIT/AFTER="''day' 07:00" or somewhat more briefly (using a combination time), you could use: $ SUBMIT/AFTER="TODAY+7-07:00" The only drawback here is if your job is delayed until the next day, you'll end up getting out of synch. So, if you really must find the next Friday to execute, you can use a loop: $ NextDay="TODAY" $ DayLoop: NextDay = F$CVTIME("''NextDay'+1-","ABSOLUTE","DATE") $ Today = F$EDIT(F$CVTIME(NextDay,,"WEEKDAY"),"UPCASE,COLLAPSE") $ IF Today .NES. "FRIDAY" THEN GOTO DayLoop $ procname = F$ENVIRONMENT("PROCEDURE") $ SUBMIT/AFTER="''nextday'+07:00" 'procname' Jobs often resubmit themselves as part of the initial processing within the batch job. The batch job can itself use lexical calls such as f$environment("PROCEDURE") to acquire the name of the currently-executing procedure, and then pass this in as part of the SUBMIT command. Another approach simply causes the job to resubmit itself daily at a specified time, and the job itself then decides to execute the full processing (only) if the current day of the week is (say) Thursday. (This is logically rather similar to the above-mentioned approach.) $ procname = F$ENVIRONMENT("PROCEDURE") $ SUBMIT/AFTER="TOMORROW+07:00" 'procname' $ Today = F$EDIT(F$CVTIME(NextDay,,"WEEKDAY"),"UPCASE,COLLAPSE") $ IF Today .NES. "FRIDAY" THEN EXIT For information on specifying the date and time, please see the HELP DCL_Tips Date_Time area in recent HELP libraries, or the similar HELP Specify area in older HELP libraries. On the other hand, you could use one of the many scheduling products available to solve this, and many other scheduling issues.
|