Subject: | |
From: | |
Reply To: | Dave Powell, MMfab |
Date: | Tue, 1 Dec 2009 18:20:46 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
It's holiday season, as good a time as any for an update on the "holiday"
function I posted a while ago -- on the off chance that there is anyone out
there who doesn't already have all the date-and-calendar routines you could
ever need. (Well, except maybe a retirement-date calculator, but I can't
help with that).
Anyway, "holiday" has been cleaned up with performance tweaks, replacing
"echo" with "setvar" to tell what holiday it is, etc. Then I wrote a
routine to help test it over a period of time, alternately calling "holiday"
and a new "tomorrow" function (which sets the date and day-of-week for the
next day, using a different day-of-week formula than the one I settled on
for "holiday").
Then I wrote two functions that also alternate between "holiday" and
"tomorrow". "Workdays" returns the number of work-days in the next "n"
real, calendar days. "Realdays" returns the number of real calendar days it
takes to get "n" work days.
"Realdays" is the main payload here. We have zillions of programs that use
"parm=" to tell them how may days to look ahead, but they don't have
in-program holiday or weekend logic. No problem when they were looking 30
or 60 days ahead, but recently people wanted some of them to look just 2 or
3 days ahead and I needed to adjust for weekends & holidays.
Now I can say:
RUN MYROG; PARM=![REALDAYS.FUNC.SHR(2)]
and it correctly returns 4 on a normal Thursday or Friday, 6 on the Tue or
Wed before Thanksgiving, etc.
"Workdays" is used in one place where I want increasingly strident warnings
as the deadline for something approaches.
Naturally I will post them if given any encouragement, or send them to
anybody who keeps a web site of such utilities.
They aren't exactly speed-demons, but they should be easy to port to any
other system or language with basic current-date and day-of-week awareness.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|