Operating System - OpenVMS
1753734 Members
4705 Online
108799 Solutions
New Discussion юеВ

Re: how to schedule a batch file

 
SOLVED
Go to solution
Gerry Downey
Frequent Advisor

how to schedule a batch file

Hi all,
I need to write a command file that will run an FTP procedure at 03:00 every night. I have the procedure working
so far as I can get it to run immediately, but dont know how to schedule it for that time. I presume I will have to submit it to a batch queue, but can anyone suggest
how I schedule it to run at that time?

Thanks
Gerry
8 REPLIES 8
Jan van den Ende
Honored Contributor
Solution

Re: how to schedule a batch file

Gerry,

simply add

$ SUBMIT /AFTER="TOMORROW+3:00"

As (nearly) the first line in

There are (much) more elegant solutions around, that take the weekday in account, and all kinds of error handling, and conditional processing etc,
but basically, the above solves what you are asking.

hth

PS.
from your profile:
I have assigned points to 7 of 68 responses.
-one of those dates back to 2004.
Perhaps time to catch up?

Proost.

Have one on me.
Don't rust yours pelled jacker to fine doll missed aches.
Karl Rohwedder
Honored Contributor

Re: how to schedule a batch file

Gerry,

you use the /AFTER qualifier to specify the start time of a batchjob, e.g.
$ SUBMIT myproc /AFTER="TOMORROW+03:00:00"

You may place this command at the top of your procedure, e.g.
$ If F$MODE().eqs."INTERACTICE"
$ THEN
$ SUBMIT ...
$ EXIT
$ ELSE
$ SUBMIT..
$ ...! the actual work
$ ENDIF

To make the routine bulletproof you may add logic to check for an already submitted job...

Another way would be to use tools like CRON.
Search the forum, there was a recent thread about scheduling.

regards Kalle

Robert Gezelter
Honored Contributor

Re: how to schedule a batch file

Gerry,

I concur with Jan and Karl.

I will add a note that you need to deal with the possibility of that either:

- the job may not resubmit itself; or
- multiple copies of the job being present

Once can get into these situations in various failure scenarios.

- Bob Gezelter, http://www.rlgsc.com
Joseph Huber_1
Honored Contributor

Re: how to schedule a batch file

To make Karls advice fully generic (i.e. independaent of file-name and queue), use this sequence:

$ proc = f$environment("PROCEDURE")
$!remove version from procedure name, so that one can change the file and
$!activate the new version without canceling the job:
$ proc = proc-f$parse(proc,,,"VERSION","SYNTAX_ONLY")
$ write sys$output f$getqui ( "DISPLAY_QUEUE", "QUEUE_NAME", "*", "THIS_JOB" )
$ myqueue = f$getqui ( "DISPLAY_QUEUE", "QUEUE_NAME", "*", "THIS_JOB" )
$!resubmit this job to run TOMORROW MORNING
$ SUBMIT/AFTER="TOMORROW+3"/LOG/noprint/queue='myqueue' 'proc'
http://www.mpp.mpg.de/~huber
Jan van den Ende
Honored Contributor

Re: how to schedule a batch file

@Joseph:

I usually just ask to use the highest version: ("proc" as in your example)

$ Proc = f$parse(";0",f$environment("procedure"))

If any related filespecs are needed, eg:

$ errfil = f$parse(".err;0",proc)

etc..

but that does not change the principle.

fwiw

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Joseph Huber_1
Honored Contributor

Re: how to schedule a batch file

Jan:
<< $ Proc = f$parse(";0",f$environment("procedure"))

There is a subtle difference vs. subraction the version from f$environment("procedure"):
your f$parse still gets a version number in the result. Now this usually makes no difference if it is used immediately afterwards. But if there is something (like generating a new version) in between, then it is not what you want.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: how to schedule a batch file

Well , I should try it before answering:
in fact the only difference is
"file;0" vs. "file" in the result.
So effectively no difference wether f$parse is followed immediatley by submit or not.
http://www.mpp.mpg.de/~huber
Gerry Downey
Frequent Advisor

Re: how to schedule a batch file

Thanks everyone, your replies have been very helpful. I will attempt to get it working ASAP (and yes, I'll get round to assigning those points) :-)