home *** CD-ROM | disk | FTP | other *** search
- March 12, 1989 <-- This was accessed via a VDE macro and not
- typed; ask me how.
-
-
- In conjunction with the enclosed *.VAR files, this alias will
- display to you the day of the week and name of the month of any
- day through 1992. If no parameters are given, it will do so for
- today's date. If parameters are given in the form:
-
- DAY mm dd yy
-
- it will display information pertaining to the specified date.
-
- Required: ZSDOS/ZDDOS/DateStamper and ARUNZ version M or later
- or
- Z80DOS and ARUNZ with Eugene Nolan's AR9NZ80D patch
-
- Not included:
-
- RESOLV13.COM; should be renamed to RS.COM
-
- Insert DATEVAR.CMD into your ALIAS.CMD.
-
- Put all *.VAR files in your root directory. If your existing
- SH.VAR has important definitions already (in other words, if you
- use it!) rename mine to something else such as DATE.VAR and
- change the 'SHF SH' command to 'SHF DATE' at the beginning of the
- alias. The enclosed SH.VAR is my personal one and has all sorts
- of other variables that I use, as do the other 7. Feel free to
- ask me what they're for but you can otherwise ignore them.
-
- I suggest having the quiet flag on for this alias (mine is on
- permanently). Also, until someone updates SHFILE to be response
- to this flag (it is not now), I suggest using my included version
- of SHF.COM.
-
- * * *
-
- I thank Dreas Nielsen for the inspiration behind this particular
- configuration of *.VAR files. This concept of using VAR files to
- determine the *name* (as opposed to its 'number') of day and
- month when given a date is essentially similar to what I
- described in my recent TCJ column, but it is implemented in a
- radically different way thanks to a tip from Dreas Nielsen. In
- response to my column in which I mentioned I had 12 different
- *.VAR files for each month of the year, as in 0189.VAR, 0289.VAR,
- 0389.VAR ... 1289.VAR, Dreas commented that this scheme
- is wasteful and necessitates having to change VAR files each
- year. He noted that a more flexible scheme would use a concept of
- 'perpetual calendar', in which the VAR files would be
- based on day-of-week rather than month. In this way they would
- therefore be reusable.
-
- Being an ecologist at heart, I immediately adopted this concept
- and created a VAR file for each day of the week, in which the
- correspondence scheme is that each of these can now perform for
- every month that *begins* with the day of week after which the
- VAR file is named. SH.VAR, for its part, contains the entries to
- reference any particular month to its corresponding VAR file.
-
- shf sh
- if nu $1
- rs shf %$dm$dy
- rs echo t%>oday is%< %$dd, %$dm$dy $dd, 19$dy.^m^j
- else
- if ~nu $3
- rs shf %$1$3
- rs echo %$1$3 $2, 19$3 %>is a%< %$2.
- shf sh
- zif
-
-
- Let's follow the alias expansion assuming a date of March 16,
- 1989 and we run DAY with no parameters. SHFILE sets the VAR file
- to SH, the default, in case it is not active (or rename SH.VAR to
- something else and change the command accordingly if you already
- use your own SH.VAR). We then have 'RESOLVE SHFILE %0389'.
- RESOLVE looks in SH.VAR and finds a shell variable named '0389'
- which I have defined in it as 'WEDNESDAY'. Using information
- taken from 4 years of calendars I have programmed this data into
- the various VAR files (you don't have to do it), simply observing
- that March, 1989 begins on a Wednesday. Therefore according to
- our scheme, we want to use the set of definitions in
- WEDNESDA.VAR. All months from 1989 through 1992 have entries in
- SH.VAR in this manner.
-
- SHFILE now makes WEDNESDA.VAR active. ARUNZ then gives us:
-
- RESOLVE ECHO TODAY IS %16, %0389 16, 1989.
-
- RESOLVE now looks in WEDNESDA.VAR for a variable named '16' and
- finds that it is defined as 'THURSDAY'. (Keep in mind that
- Wednesday is only the day on which the month *begins* and is used
- only to identify our VAR file; don't confuse it with the current
- or specified day.) It then looks in WEDNESDA.VAR for the same
- variable which we had a moment ago, '0389'. However this time
- we are in a different VAR file and it therefore has an entirely
- different definition, 'MARCH'. We therefore get what we wanted:
-
- ECHO TODAY IS THURSDAY, MARCH 16, 1989.
-
- Similarly if parameters are entered, such as 'DAY 10 13 91'.
- ARUNZ gives us 'RESOLVE SHFILE %1091', and RESOLVE looks in
- SH.VAR and finds that the string variable '1091' is defined as
- 'TUESDAY'. SHFILE therefore sets the current file to TUESDAY.VAR
- ARUNZ then gives us:
-
- RESOLVE echo %1091 13, 1991 is a %13
-
- RESOLVE looks in TUESDAY.VAR, finds that '%1091' is *there*
- defined as 'OCTOBER' and '%13' is defined as 'SUNDAY', and we're
- in business with:
-
- OCTOBER 13, 1991 is a SUNDAY.
-
- * * *
-
- Thank you, Dreas -- I have not only decreased the number of VAR
- files needed for these tasks from 12 to 7, but they are now valid
- until 1993 (this is an arbitrary limit; it would take no time at
- all to add more years) rather than every year.
-
-
- Rick Charnes, San Francisco, (415) 826-9448 voice
-
- March 12, 1989