- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: submiting a job based on the day of the week
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 05:50 AM
04-06-2005 05:50 AM
submiting a job based on the day of the week
using the submit/after command. I need to be able to submit a job every 30 mins, between the hours of 5:00am and midnight, Monday thru Friday and on the weekend (Sat & Sun) between the hrs of 7:00am and midnight. I tried both absolute and delta times with little success.
Any assistance would be greatly apprciated.
Thanks,
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 06:24 AM
04-06-2005 06:24 AM
Re: submiting a job based on the day of the week
I'm curious about what you tried that didn't work. Of course there is no builtin mechanism in the VMS batch queue syntax to issue a small number of commands to create the behavior that you're looking for.
There are commercial and freeware packages that might make it easier to do something like that.
The most direct method is to create a command procedure that does something like this:
Wake up
Is it between 5:00 AM and Midnight M-F? or between 7AM and midnight on Sat-Sun? if so submit the job to be run
Generate the next time to wake up
(the WAIT command will accept an absolute time so that you can cause the wakeup to occur right on the hour and 30 minute intervals). If the time is after midnight, calculate the next wakeup time as 5:00 AM or 7:00 AM depending on the day of the week.
Wait until next time to wake up
The simplest way of doing this is in a DCL command procedure. There are ways to do the same thing in an executable image of course with fancier bells and whistles, but the DCL solution is pretty straightforward.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 06:42 AM
04-06-2005 06:42 AM
Re: submiting a job based on the day of the week
Thanks for your response. I'm in the processing of creating a DCL command procedure. I'll let you know how it goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 07:19 AM
04-06-2005 07:19 AM
Re: submiting a job based on the day of the week
You do exactly what you need with DCL. Depending on your log requirements, another option might be to have 1 job running all day and pausing until the next 30 minute window. Some DCL fragments which might help.
$ DAY_OF_WEEK_NAME = F$CVTIME(,,"WEEKDAY")
.
$ if DAY_OF_WEEK_NAME .eqs. "Sunday" then goto resubmitit
.
$ XHOUR = F$INTEGER(F$EXTRACT(12,2,F$TIME()))
$ if xhour .lt. 2 then . . . .
.
.
$resubmitit:
If the system is booted you'll need something in the startup or use "/restart" in your submit command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 07:52 AM
04-06-2005 07:52 AM
Re: submiting a job based on the day of the week
I like Roberts suggestion a lot. Instead of a complicated re-submit logic, just have the job resubmit in 30 minutes all the time (/after="+0:30")
Then just test for the right window using f$cvtime. Weekend are easy to recognize in english (and dutch) as both days start with the same unique char: S (or Z).
$ weekend = ("S".eqs.f$extr(0,1,f$cvtime(,,"WEEKDAY")))
$start_hour = 5 + 2 * weekend
or
$start_hour = 5 + 2*("S".eqs.f$extr(0,1,f$cvtime(,,"WEEKDAY")))
the full code:
$submi/after="+0:30" 'f$env("procedure")
$if f$cvtime(,,"HOUR").LT. start_hour then exit
A possible selective submit solution (untested):
$next=f$cvtime(" +0:30","ABSOLUTE")
$start_time = "05:00:00"
$ if "S".eqs.f$extr(0,1,f$cvtime(,,"WEEKDAY")) then start_time = "07:00:00"
$ next_time = f$cvtime(next,,"TIME")
$ next_date = f$cvtime(next,"ABSOLUTE","DATE")
$ if next_time.les.start_hour then next_time = start_hour
$ subm/after="''next_date' ''next_time'" 'f$env("procedure")
Enjoy!
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 07:54 AM
04-06-2005 07:54 AM
Re: submiting a job based on the day of the week
ooops. at least one typo.
$ if "S".eqs.f$extr(0,1,f$cvtime(,,"WEEKDAY")) then start_time = "07:00:00"
That should be:
$ if "S".eqs.f$extr(0,1,f$cvtime(next,,"WEEKDAY")) then start_time = "07:00:00"
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 08:00 AM
04-06-2005 08:00 AM
Re: submiting a job based on the day of the week
I'll try your suggestions tomorrow and let you know If I was successful.
Thanks again.
Sincerely,
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 08:17 AM
04-06-2005 08:17 AM
Re: submiting a job based on the day of the week
Just a (humerous) follow on to Hein's comment (no offense intended to Hein). I strongly recommend that you check for the entire "day of week" value against a string containing all of the days of the week (e.g., "/Monday/Tuesday/Wednesday/.../Sunday/") using the F$LOCATE lexical function.
If, through some strangeness (or future change in either OpenVMS or the user's configuration), you end up getting the names back in some unexpected language, you will not run "off the rails" in an uncontrolled fashion. I would not rely on the fact that (in English) the names for the weekend days (and only the weekend days) start with "S").
The one extra line of DCL code, and the assocaited check that the name is one of the expected ones, costs little and prevents problems in the future.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 08:54 AM
04-06-2005 08:54 AM
Re: submiting a job based on the day of the week
And in that same spirit Bob, how would the French Sunday 'Dimanche' look up in your table Bob?
:-) :-) :-)
Over engineering: If dcl had a day-of-the-I suppose you could determine the day of the week for today, add the appropriate days to make it weekend ask for the name of that day and so on. But then, what is a weekend?
Nah, I'm afraid you'r stuck with hardcoding, and in that case "S" is hust about as bad as "Saturday". Admittedly, with "Saturday" you could do the belt and suspenders thing of reporting an error if the day is not found in the table at all.
More readable, still language dependend, solution:
$ weekend = " Saturday Sunday "
$ start_hour = 5 + 2*(f$len(weekend).ne.f$loc(f$cvtime(,,"WEEKDAY"),weekend))
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 09:20 AM
04-06-2005 09:20 AM
Re: submiting a job based on the day of the week
$! P1 -- global symbol to put the value into
$! P2 -- ,, ,, ,, ,, ,, day name into
$! p3 -- time to use
$ vfl = F$VERIFY(0)
$ sunday = 0
$ monday = 1
$ tuesday = 2
$ wednesday = 3
$ thursday = 4
$ friday = 5
$ saturday = 6
$ day_name = f$cvtime(p3,,"weekday")
$ day_num = 'day_name'
$ IF P1 .NES. "" THEN GOTO ret_parm
$ WRITE SYS$OUTPUT "Today is ",day_name,"."
$ EXIT
$ ret_parm:
$ 'P1' == day_num
$ IF P2 .NES. "" THEN 'P2' == day_name
$ vfl = F$VERIFY(vfl)
$ EXIT
$!Last Modified: 16-OCT-1987 09:38:21.12, By: RLB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 09:59 AM
04-06-2005 09:59 AM
Re: submiting a job based on the day of the week
For slightly more language independence give the work to DCL. You can code for several languages (but *complete* language independence might be a bit voluminous) like this:
$ ON WARNING THEN GOTO UnexpectedDay
$ GOTO DAY_'F$CVTIME(,,"WEEKDAY")
$ UnexpectedDay:
$ ! Error Trap
$ EXIT
$ ...
$ DAY_Sunday:
$ DAY_Saturday:
$ DAY_Dimanche:
$ DAY_weekend-in-your-language:
$ ! Weekend branch
$ GOTO BackToMainLine
$
$ DAY_Monday:
$ DAY_Tuesday:
$ DAY_Wednesday:
$ etc...
$ ! Weekday branch
$ GOTO BackToMainLine
If you're running V8.2 or higher, there are more options. Specifically we can eliminate all language dependencies.
1-JAN-1990 was a Monday, so:
$ J=F$DELTA("1-JAN-1990",F$TIME())
$ D=J-J/7*7
will return 0 for Monday, 1 for Tuesday etc... So your test for a weekend day becomes simply:
$ IF D.GE.5
$ THEN
$ ! weekend branch
$ ELSE
$ ! weekday branch
$ ENDIF
WARNING - since Delta times are limited to 10000 days, the above code will fail for dates after May 2017.
I think I'll a suggestion that F$CVTIME(date,"COMPARISON","WEEKDAY") should return a number...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 12:35 PM
04-06-2005 12:35 PM
Re: submiting a job based on the day of the week
>>
>> $ J=F$DELTA("1-JAN-1990",F$TIME())
>> $ D=J-J/7*7
Ah... My kinda thinking, but I did not have V8 to try. Good.
>> the above code will fail for dates after May 2017.
or you could just start closer in.
>> I think I'll a suggestion that F$CVTIME(date,"COMPARISON","WEEKDAY") should return a number...
I suppose you could call it a a low impact bug, as "MONTH" already does the right thing for ABS vs COMPARE
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2005 06:51 PM
04-06-2005 06:51 PM
Re: submiting a job based on the day of the week
>I suppose you could call it a a low impact bug, as "MONTH" already does the right thing for ABS vs COMPARE
Unfortunately it's not quite as simple as it seems at first. The default output format is "COMPARISON", so to do this in a safe, upwards compatible manner, we'd have to change the default output format for "WEEKDAY" to "ABSOLUTE" and return numeric values only if the output format was explicitly "COMPARISON". It's probably more difficult to describe in the documentation than actually implement...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2005 08:16 AM
04-07-2005 08:16 AM
Re: submiting a job based on the day of the week
Sorry I didn't reply sooner. Thank you for all your responses. I "TRULY" appreciate the help. I won't be able to work on this issue until Monday. Bosses are always changing priorities. I will keep you posted on my progress. Thanks again.
Sincerely,
Pat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2005 08:53 AM
04-07-2005 08:53 AM
Re: submiting a job based on the day of the week
(Smile) Perhaps I was unclear, I did write that response in a hurry.
I meant to say:
- If you find "Saturday" or "Sunday", then you are ok.
- If no string matches, take some appropriate action (error message: "Language not English"... If I had the time, I would delve into the multi-language support, my recollection is that there is a clean way to tell if your language is English, but it should not be too hard to find in the manual.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2005 09:06 AM
04-07-2005 09:06 AM
Re: submiting a job based on the day of the week
(LNM$SYSTEM_TABLE)
"SYS$LANGUAGE" = "ENGLISH"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2005 09:25 AM
04-08-2005 09:25 AM
Re: submiting a job based on the day of the week
A freeware international solution of the day of week might include something like this using symbols:
$! Is_Weekend.com
$! Defines weekend names.
$weekend==""
$weekend_day_1=""
$weekend_day_2=""
$if (f$trnlnm("SYS$LANGUAGE")) .eqs. "ENGLISH"
$THEN
$ weekend_table=="Saturday,Sunday"
$ weekend_day_1=="Saturday"
$ weekend_day_2=="Sunday"
$ELSE
$! Non-English Customizations
$ENDIF
.
.
.
$exit
or it could be done with system logicals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2005 05:28 PM
04-08-2005 05:28 PM
Re: submiting a job based on the day of the week
Cheers,
Robert