- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
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
01-17-2006 06:52 AM
01-17-2006 06:52 AM
FIND THE FIRST WORKING OF DAY OF EACH MONTH
- Tags:
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 07:44 AM
01-17-2006 07:44 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
alp $ write sys$output f$cvtime( "1-jan-2005", , "WEEKDAY")
Saturday
alp $ write sys$output f$cvtime( "2-jan-2005", , "WEEKDAY")
Sunday
alp $ write sys$output f$cvtime( "3-jan-2005", , "WEEKDAY")
Monday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 07:44 AM
01-17-2006 07:44 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
First Monday of the month?
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 08:45 AM
01-17-2006 08:45 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:00 AM
01-17-2006 09:00 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
"HOLIDAY_FOR_ME" output_field option for the
F$CVTIME() lexical function. It doesn't seem
to be a very well defined concept.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 06:05 PM
01-17-2006 06:05 PM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:59 PM
01-17-2006 09:59 PM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
It uses general algorithms (e.g. for Easterday), and additional customization by external files.
If You can find it on the freeware sites, here is my copy:
http://wwwvms.mppmu.mpg.de/vms$common/com/holidays.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 03:30 AM
01-18-2006 03:30 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Should do the trick for you.
Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 06:20 AM
01-18-2006 06:20 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
a suggestion/request for you -- if you post DCL procedures here, please change the file type to .txt since some companies prevent access to files that look like Windows executable code from web sites.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 06:24 AM
01-18-2006 06:24 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 06:42 AM
01-18-2006 06:42 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Where can I file the holidays.dat file. should i create one.
sne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 06:43 AM
01-18-2006 06:43 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
sne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 08:07 AM
01-18-2006 08:07 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=993097
CVTIME.COM provides sample code of how to calculate the beginning of a month.
Then you can use the code provided for checking if it's a weekend or holiday, and if so, bump the date ahead by 1 until you get one that is neither weekend nor holiday.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 08:38 AM
01-18-2006 08:38 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Yes. Create a file called holidays.dat and put a list of holidays in it e.g. as follows:
20051226
20051227
20060102
Where the dates correspond to your actual holiday dates, of course.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 07:17 PM
01-18-2006 07:17 PM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
One of the examples provided refers to the July 4th holiday:
#############################################################################
# Here's a tricky problem: The 4th of July is a holiday in the U.S.
# However, if it falls on a Saturday, the previous Friday is a holiday.
# If it falls on a Sunday, the next Monday is a holiday. Here's how
# to do it.############################################################################
# Calculate the weekday of the holiday.
REM 4 July SCANFROM [_back(7)] SATISFY 1
IF WKDAYNUM(TRIGDATE()) == Sat
REM [TRIGGER(TRIGDATE())] MSG Independence day (actual)
OMIT [TRIGGER(TRIGDATE()-1)] MSG Independence day (observed)
ELSE
IF WKDAYNUM(TRIGDATE()) == Sun
REM [TRIGGER(TRIGDATE())] MSG Independence day (actual)
OMIT [TRIGGER(TRIGDATE()+1)] MSG Independence day (observed)
ELSE
OMIT [TRIGGER(TRIGDATE())] MSG Independence day
ENDIF
ENDIF
You can find it at http://www.roaringpenguin.com/penguin/open_source_remind.php . In my experience, it wasn't hard to get it to compile under VMS.
cu,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2006 08:30 AM
01-19-2006 08:30 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
If you a system admin, then a good place for this would be in a monthly processing section of DAILY_MGR.COM (or whatever you have).
$! For English language
$ IF (F$CVTIME("TODAY",,"WEEKDAY").NES. "Saturday").AND.
(F$CVTIME("TODAY",,"WEEKDAY").NES. "Sunday") $ THEN
$! Calculate first business day of month
...
$! If first business day of month then submit your job.
$ IF F$CVTIME("TODAY",,"DAY") .EQS. FIRST_BUSINESS_DAY THEN SUBMIT ...
$ ENDIF
Lawrence
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2006 10:45 AM
01-19-2006 10:45 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
You might want to stick them into an indexed file for easy key lookup.
You might want to seed the file with a script, and then review and tweak as needed.
(datatrieve, dcl, edit+reconvert,...)
Below two DCL scripts to get you going with this. The first will create a file. The second will do a lookup. GIve it a whirl?
-------------- FIRST_WORKING_DAY.com -------
$! This procedure will generate a list of the first non-weekend days in each month.
$!It will create and seed the file if needed.
$! Provide YEAR to generate dates for as argument. Default is this year.
$
$file = F$ELEM(0,";",F$ENVI("PROCEDURE")) + "~" - ".COM~" + ".DAT"
$year = F$CVTIME("",,"YEAR")
$IF p1.nes."" THEN year = p1
$months := JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
$Sunday_day := "02"
$Saturday_day := "03"
$month = 0
$OPEN/READ/WRITE/SHARE=WRITE/ERROR=create_file file 'file
$write:
$flag = " "
$date = "01-" + F$EXT(month*3,3,months) + "-" + year
$day = F$CVTIME(date,,"WEEKDAY")
$IF F$TYPE('day'_day) .NES. ""
$THEN
$date = 'day'_day + F$EXTR(2,9,date)
$flag := "*"
$ENDIF
$numeric_date = F$CVTIME(date,"COMPARISON","DATE") - "-" - "-"
$record = numeric_date + flag + date
$WRITE file record
$month = month + 1
$IF month .LT. 12 THEN GOTO write
$CLOSE file
$oops:
$EXIT
$
$create_file:
$CREATE/LOG/FDL=SYS$INPUT: 'file
file; organization indexed; key 0; seg0_length 8
$OPEN/READ/WRITE/ERROR=oops file 'file
$WRITE file "99999999 01-APR-9999" ! Stopper
$GOTO write
$
-------- lookup_FIRST_WORKING_DAY.com ------
$file = F$ELEM(0,";",F$ENVI("PROCEDURE")) + "~" - ".COM~" + ".DAT" - "LOOKUP_"
$date = F$TIME()
$IF p1.nes."" THEN date = p1
$target_year = F$CVTIME(date,,"YEAR")
$OPEN/READ/SHARE=WRITE/ERROR=create_file file 'file
$numeric_date = F$CVTIME(date,"COMPARISON","DATE") - "-" - "-"
$READ/MATCH=GT/KEY=&numeric_date file record
$numeric_first_working_day = F$EXTR(0,8,record)
$first_working_day = F$EXTR(9,99,record)
$SHOW SYMBOL first_working_day
$CLOSE file
$IF numeric_first_working_day .EQS. "99999999" THEN EXIT 9372
$EXIT
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2006 01:04 AM
01-20-2006 01:04 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Some days are holidays ONLY to Jews, others ONLY to Muslims, or ONLY to catholics (but not to other Christians), and ... (please extend at will).
Then there exist days that are ONLY holidays to inhabitants of certain areas or towns (personal example: to me and my town-fellows April 1 is just about the biggest holiday of the year - the start of the liberation of the Netherlands back in 1572 by freeing our town Brielle).
Now, anyone who can get ALL of those together in one routine, THAT would be an achievement!
I'm clearly having a bad case of the Friday-afternoon feeling :-) :-)
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2006 02:43 AM
01-20-2006 02:43 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2006 06:52 AM
01-20-2006 06:52 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
(it still is friday!)
I could not find any means in your datafile to distinguish Jewish users from Catholics from Muslims from Buddhists from Briellenaren from Bavarians from .... :-)
and still, those different users have different holidays, even if users of the same system.
Multicultural societies are complex, and complex societies have complex problems!
Proost.
Have one on me.
jpe
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2006 07:04 AM
01-20-2006 07:04 AM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
This is a good thing!
This procedure accepts all religions and treats them all equally. Even Jewish, Catholics, Muslims, Buddhists, Briellenaren, Bavarian or any other religion you wish to invent.
Simply put in the date of the holiday into the datafile and it is immediately accepted - no questions asked.
And, I think I will have one on you - thank you!
Doug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2006 09:40 PM
01-20-2006 09:40 PM
Re: FIND THE FIRST WORKING OF DAY OF EACH MONTH
This is a good thing!
This procedure accepts all religions and treats them all equally.
It _WOULD_ be a good thing if religions were prepared to be treated equally.
Just look at the dayly news broadcasts: how may wars are currently being fought that are (at least partly) religion-based?
That is my whole point: as soon as you pick one to base your holiday definitions upon, all others are discriminated, which is "not always" well-received!.
Then again, a day that is a holiday for only part of the users, probably is a working day for some others, meaning that for "the system" it is to be treated as a working day....
VERY hard to find a consensus!
... and we do not have the problem anyhow, being a full 24 * 365 organisation.
I think I will wash down the confusion with a good beer and forget about it.
Proost.
Have one on me.
jpe