HP3000-L Archives

September 2004, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tracy Pierce <[log in to unmask]>
Reply To:
Tracy Pierce <[log in to unmask]>
Date:
Thu, 9 Sep 2004 20:12:11 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (142 lines)
defaults to current date, sets DV@ with DV_HOLIDAY=1 when appropriate.

YODA:TRACY.VMS,KTP:print datetest.pub.sys
PARM DP_CYMD=!HPYYYY*10000+!HPMONTH*100+!HPDATE
SETVAR DV_CYMD !DP_CYMD
ECHO DATETEST.PUB.SYS !DV_CYMD ...
comment This sets DV_HOLIDAY=1 if parmdate's a holiday, and
comment      sets DV_DAY = 1-relative day-of-week-no (like HPDAY).
comment 981208 KTP (HOLIDAY, too, for backward compatibility).
comment Parmdate format=CCYYMMDD; default = TODAY.
comment If CC's omitted, date's assumed in the range 1951-2050.
comment Example: :DATETEST 19981127 (day after Thanksgiving 1998)
comment          :SHOWVAR DV@
comment          DV_HOLIDAY = 1
comment NOTE: Your date-parm is *NOT* VALIDATED; many invalid dates
comment       will work as if they were ok; month<1or>12 bombs.
comment ************************************** setvar DV_HOLIDAY...
comment ...to 1 when "date is NOT a Saturday or Sunday, but GGBHTD
comment offices are closed"; same as "all national holidays plus
comment the day after Thanksgiving", specifically...
comment   Jan  1 = New Year's Day
comment   Jul  4 = Independence Day
comment   Nov 11 = Veterans Day
comment   Dec 25 = Christmas
comment   3rd Jan Mon = MLK day (range=15-21)
comment   3rd Feb Mon = Presidents Day (range=15-21)
comment   LAST May Mon = Memorial Day (range=25-31)
comment   1st Sep Mon = Labor Day (range=1-7)
comment   4th Nov Thu = Thanksgiving Day (range=22-28)
Comment   Friday after 4th Nov Thu is a GGBHTD holiday(23-29)
comment
comment ensure 4-digit year...
IF !DV_CYMD < 1000000
  COMMENT assume 19xx if xx>50 else 20xx...
  IF  !DV_CYMD > 501231
    SETVAR DV_CYMD 19000000 + !DV_CYMD
  ELSE
    SETVAR DV_CYMD 20000000 + !DV_CYMD
  ENDIF
ENDIF
comment separate parm into year month day...
SETVAR DV_YYYY STR("!DV_CYMD",1,4)
SETVAR DV_MM   STR("!DV_CYMD",5,2)
SETVAR DV_DD   STR("!DV_CYMD",7,2)
IF !DV_YYYY=!HPYYYY AND !DV_MM=!HPMONTH AND !DV_DD = !HPDATE
  SETVAR DV_DAY !HPDAY
ELSE
  comment determine day of week...
  SETVAR DV_DAY &
(47/86) Continue?
    STR ( "000031059090120151181212243273304334",!DV_MM * 3 - 2, 3 )
  SETVAR DV_DAY !DV_DAY + !DV_DD
  IF  !DV_MM > 2 AND ( !DV_YYYY / 4 * 4 = !DV_YYYY )
    SETVAR DV_DAY DV_DAY + 1
  ENDIF
  SETVAR DV_YWK !DV_YYYY - 1
  SETVAR DV_DAY !DV_DAY + ( !DV_YWK / 400 ) * 146097
  SETVAR DV_YWK !DV_YWK MOD 400
  SETVAR DV_DAY !DV_DAY + ( !DV_YWK / 100 ) * 36524
  SETVAR DV_YWK !DV_YWK MOD 100
  SETVAR DV_DAY !DV_DAY + ( !DV_YWK / 4 ) * 1461
  SETVAR DV_YWK !DV_YWK MOD 4
  SETVAR DV_DAY !DV_DAY + ( !DV_YWK * 365 )
  SETVAR DV_DAY ( DV_DAY MOD 7 ) + 1
  DELETEVAR DV_YWK
ENDIF
SETJCW HOLIDAY 0
SETVAR DV_HOLIDAY 0
IF  !DV_DAY <> 1 AND !DV_DAY <> 7
  IF (!DV_MM=1  AND !DV_DD=1 ) &
  OR (!DV_MM=7  AND !DV_DD=4 ) &
  OR (!DV_MM=11 AND !DV_DD=11) &
  OR (!DV_MM=12 AND !DV_DD=25)
(70/86) Continue?
    SETVAR DV_HOLIDAY 1
  ENDIF
  IF (!DV_MM=1  AND !DV_DAY=2 AND !DV_DD>=15 AND !DV_DD<=21 ) &
  OR (!DV_MM=2  AND !DV_DAY=2 AND !DV_DD>=15 AND !DV_DD<=21 ) &
  OR (!DV_MM=5  AND !DV_DAY=2 AND !DV_DD>=25 AND !DV_DD<=31 )
    SETVAR DV_HOLIDAY 1
  ENDIF
  IF (!DV_MM=9  AND !DV_DAY=2 AND !DV_DD>=1  AND !DV_DD<=7  ) &
  OR (!DV_MM=11 AND !DV_DAY=5 AND !DV_DD>=22 AND !DV_DD<=28 ) &
  OR (!DV_MM=11 AND !DV_DAY=6 AND !DV_DD>=23 AND !DV_DD<=29 )
    SETVAR DV_HOLIDAY 1
  ENDIF
  IF !DV_HOLIDAY = 1
     SETVAR HOLIDAY 1
  ENDIF
ENDIF
SHOWVAR DV@
> From: Greg Stigers [mailto:[log in to unmask]]
> Sent: Thursday, September 09, 2004 8:03 PM
> To: [log in to unmask]
> Subject: Re: Labor Day and other holidays
>
>
> Quoting Paul Christidis <[log in to unmask]>:
> > Then its just a matter of keeping the 'holiday' file
> current.  Which would
> > be easier than keeping the code, below, current.
> I don't follow. Assuming that a company fairly consistently
> takes the same set
> of holidays each years, following reasonable rules
> consistently, I would think
> that my command file would continue to work until those
> holidays or their rules
> change. For instance, because of our line of business, we do
> not take the day
> after Thanksgiving. Should that ever change, then I add two
> lines to the
> command file. And so on. Whereas, while one could admittedly
> build a file such
> as you suggest for the rest of this century (or have an
> appropriate set of
> fourteen files for the fourteen permutations of our
> calendar), you would still
> be subject to the same issue, changing the controlling file
> when company policy
> changes.
>
> I don't see how my command file would need to be changed
> under any circumstances
> that would not also affect your holiday file. That said, I
> have considered
> exactly the approach you describe as being both idiot-proof
> and much simpler to
> test.
>
> Does anyone else handle their own scheduling without the
> benefit of third-party
> products? How do you handle holidays?
>
> Greg
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2