1828161 Members
2520 Online
109975 Solutions
New Discussion

OpenVMS Job Batch Queue

 
SOLVED
Go to solution
Taulant Shamo
Frequent Advisor

OpenVMS Job Batch Queue

I have created a file.com which perform backup
and I want it to run for example everyday only at 01:00 am. I have created it as below:
But in this state it runs only one time, not every day.


$ initialize/queue/batch/start TEST$BACH
$ date = F$CVTIME("TODAY")
$ year = F$EXTRACT(2,2,date)
$ month = F$EXTRACT(5,2,date)
$day = F$EXTRACT(8,2,date)
$TEST_date = year + month + day
$submit/AFTER="tomorow +1" DSA1:[000000.VODAFONE.TEST]TEST.com -
/log=DSA1:[000000.VODAFONE.TEST]TEST'TEST_date'.LOG -
/queue=TEST$BACH -
/user=INS -
/param=("''TEST_date'")
$EXIT



7 REPLIES 7
Jan van den Ende
Honored Contributor
Solution

Re: OpenVMS Job Batch Queue

Taulant,

WELCOME TO VMS!

You obviously found out that VMS lacks a decent native batch scheduler.

One way around that is to buy a third party one, but that is not everybody's choice.

What you CAN easily do, is to include your submit sequence IN your submitted procedure!

Using your example above,
TEST.COM would then start with:

$ date = F$CVTIME("TODAY")
$ year = F$EXTRACT(2,2,date)
$ month = F$EXTRACT(5,2,date)
$day = F$EXTRACT(8,2,date)
$TEST_date = year + month + day
$submit/AFTER="tomorow +1" DSA1:[000000.VODAFONE.TEST]TEST.com -
/log=DSA1:[000000.VODAFONE.TEST]TEST'TEST_date'.LOG -
/queue=TEST$BACH -
/user=INS -
/param=("''TEST_date'")

..... and from here on the rest of what you already had in TEST.COM.

As this code executes "tomorrow +1",
it then is already "tomorrow", so your TEST_DATE will also be tomorrow's date etc.

...
Just a few remarks though.

-- you code TOMOROW, but that keyword is TOMORROW, with RR
-- better loose the "000000" in your file specifications
-- since this job runs as user INS, you don't have to specify /USER=INS. That releaves you of the need to let user INS have CMKRNL privilege.
-- make it a habit to have your code, parameter files, and everything that changes very little, in a different directory from 'scratchy' stuff like LOG-files etc.
If your system grows, it will help keep things manageble.


Somewhat deeper:

-- if you want your system to have more flexibility, start using Concealed Devices

Concealed devices behave like devices, but you can have many of them on one disk, and you can move them independently at your convenience, eg, if you add another disk and want to spread the load, or if you have to move to another system, or want to spread it to another system, that maybe does not even have shadowsets.

To do this, add these lines to SYS$STARTUP:SYLOGICALS.COM

$ DEFINE/EXECUTIVE/SYSTEM VODAFONE_ROOT -
DSA1:[VODAFONE.]/translation=concealed

$ DEFINE/EXECUTIVE/SYSTEM LOGGING_ROOT -
DSA2:[LOGGING.]/TRANSLATION=CONCEAL

(it may be hard to see in the browser, but be sure to have a ".", that is, a point, just before the "]". )

first time, execute these interactively as well.

Now your piece of code would become

$ date = F$CVTIME("TODAY")
$ year = F$EXTRACT(2,2,date)
$ month = F$EXTRACT(5,2,date)
$day = F$EXTRACT(8,2,date)
$TEST_date = year + month + day
$submit/AFTER="tomorrow +1" -
VODAFONE_ROOT:[TEST]TEST.com -
/log=LOGGING_ROOT:[VODAFONE.TEST]TEST'TEST_date'.LOG -
/queue=TEST$BACH -
/param=("''TEST_date'")


Have fun,
Enjoy!

..and do not hesitate to come back again if you have more questions!!

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Keith Cayemberg
Trusted Contributor

Re: OpenVMS Job Batch Queue

Hi Taulant,

I have little to add to Jan's excellent description. I have however collected a list of Job Scheduling software (some are free) for OpenVMS. I have attached a HTML file to this post. As you can also see that many companies have developed (and live from) solutions to provide comfortable scheduling of Jobs and controlling of Queues.

Cheers!

Keith Cayemberg
Keith Cayemberg
Consultant
Wipro Technologies
Taulant Shamo
Frequent Advisor

Re: OpenVMS Job Batch Queue

Thank you for your suggesstions for using using Concealed Devices, but i cant change anything in configuration due to policies of company. All what I have to do is to change what i have created myself without modifyng systems scripts. About code TOMORROW I written only in my question wrong not in the file(TOMOROW), but i doesn't worked.
I have changed now the script about some of your suggestions. Now thsi script TEST.COM run only one minute after running this command @RUN_TEST.COM which call TEST.COM
But I what to run note only one minute after runninr @RUN_TEST.COM but every minute.

If you have knowlidge for UNIX I will make an analogy. Crontab i Unix is Like Batch Queue in Open VMS
to run a script in crontab every minute I can run in thsi way.
1,2,3,4,5,6,......,60 * * * * $HOME/script.sh

$ initialize/queue/batch/start TEST$BACH
$ date = F$CVTIME("TODAY")
$ year = F$EXTRACT(2,2,date)
$ month = F$EXTRACT(5,2,date)
$day = F$EXTRACT(8,2,date)
$LOG_date = year + month + day
$submit/AFTER="00:01" DSA1:[000000.VODAFONE.TEST]TEST.com -
/log=DSA1:[000000.VODAFONE.TEST.LOGS]Log'LOG_date'.LOG -
/queue=TEST$BACH -
/param=("''TEST_date'")
$EXIT
Hein van den Heuvel
Honored Contributor

Re: OpenVMS Job Batch Queue

The re-submit .com in .com is very common practice.

The hard-coding of filespecs as you show is relatively poor practice: error prone, inflexible. On the other hand, there are cases you just want that one procedure to run, no logicals, no search-lists, no alias names, just that one file or bust.

Since in an other recent topic you just asked about learning DCL, please study the following tools to pick-up, pick-apart, and reconstruct, filenames:

$com_file = f$elem(0,";",f$envi("procedure"))
$tmp_file = f$pars(".TMP;",com_file,,,"SYNTAX_ONLY")
$log_file = f$elem(0,"]",com_file) + "]" + -
f$parse(com_file,,,"NAME") + "_XXXX.LOG"
$

- The first line, besides showing how to get your own filename, removes the specific version to make sure edits will take.

- The second line shows how to NOT play with dots and semicolons and yet change parts of a filespec by exploiting the 'default name' component of f$parse.

- The third like then does play with a meta character again to find the directory.
(DCL lacks the 'basename' 'dirname' that Unix has).
Then it used the F$PARSE ... 'field' option to find the real name, and tweaks it along the lines of your code example

Hein.

Antoniov.
Honored Contributor

Re: OpenVMS Job Batch Queue

Hi Taulant,
because it seems you are newbie in vms I hope you accept some clue.
If you need year, month, day or other data field you can use F$CVTIME() funcion as follow:
$ year=F$CVTIME("",,"YEAR")
The first parameter is TODAY when omitted, the 3th value is the field you want (see HELP LEX F$CVTIME for more details).
Another way to calculate date & time are:
1) The current time + 1 hour
$ Next_Hour=F$CVTIME("+01:00")
2) Tomorrow at current time
$ Next_Day=F$CVTIME("+1-00:00")
3) Tomorrow at 09:00 am
$ Next_Day=F$CVTIME("TOMORROW+09:00")

Antonio Vigliotti


Antonio Maria Vigliotti
Bojan Nemec
Honored Contributor

Re: OpenVMS Job Batch Queue

Taulant,

Looking at yours second question I realize that you have missed Jans suggestion. He want to tell you that you put the code at the beginning of the TEST.COM so the first thing that this procedure does is submiting itself for the next run. With this the procedure acts as an rescheduler for itself.

I use to put another line after the submit command:

$ if f$mode().eqs."INTERACTIVE" then exit
or
$ if f$mode().nes."BATCH" then exit

With one of this two lines you dont need the RUN_TEST.COM. The TEST.COM is acting as RUN_TEST.COM when you run it from the command line ($ @TEST.COM) and as RUN_TEST.COM and TEST.COM when it runs in a batch queue. The new TEST.COM (if you put an /AFTER="+01:00" in the submit command) will run every minute yust like a */1 * * * * entry in the UNIX crontab.

If you cant modify the TEST.COM then you must write a new procedure (for example SCHEDULE_TEST.COM) which will act as a rescheduler for itself and will submit the TEST.COM every run. Maybe is better to write an example:

$ submit/after="+01:00" SCHEDULE_TEST.COM
$ if f$mode().nes."BATCH" then exit
$
$ date = F$CVTIME("TODAY")
$ year = F$EXTRACT(2,2,date)
$ month = F$EXTRACT(5,2,date)
$ day = F$EXTRACT(8,2,date)
$ TEST_date = year + month + day
$ submit DSA1:[VODAFONE.TEST]TEST.com -
/log=DSA1:[VODAFONE.TEST]TEST'TEST_date'.LOG -
/queue=TEST$BACH -
/user=INS -
/param=("''TEST_date'")
$EXIT

This procedure will in its first line reschedule itself for the next run (it will be much better to use Heins suggestion, but for simplicity I just use SCHEDULE_TEST.COM).
In the second line it will exit if it is not in batch mode, so you can simply run it to start the rescheduling. The next lines are taken from yours example. The only thing that is changed is that the /AFTER qualifier is ommited (which means run immediate) and without the 000000 in directory names (as Jan says - you dont need them).

Bojan
Taulant Shamo
Frequent Advisor

Re: OpenVMS Job Batch Queue

Thank you for your precious help.
I finally make it working with your help.
Yesterday I was a bit confused due to lack of time.
Thank you all.