home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / day10.lbr / DAY.DZC / DAY.DOC
Encoding:
Text File  |  1989-03-12  |  5.3 KB  |  127 lines

  1. March 12, 1989  <-- This was accessed via a VDE macro and not 
  2.                     typed; ask me how. 
  3.                        
  4.  
  5. In conjunction with the enclosed *.VAR files, this alias will 
  6. display to you the day of the week and name of the month of any 
  7. day through 1992.  If no parameters are given, it will do so for 
  8. today's date.  If parameters are given in the form:
  9.  
  10.                           DAY mm dd yy
  11.  
  12. it will display information pertaining to the specified date.
  13.  
  14. Required:  ZSDOS/ZDDOS/DateStamper and ARUNZ version M or later
  15.                                   or
  16.            Z80DOS and ARUNZ with Eugene Nolan's AR9NZ80D patch
  17.  
  18.     Not included:
  19.  
  20. RESOLV13.COM; should be renamed to RS.COM
  21.  
  22. Insert DATEVAR.CMD into your ALIAS.CMD.
  23.  
  24. Put all *.VAR files in your root directory.  If your existing 
  25. SH.VAR has important definitions already (in other words, if you 
  26. use it!) rename mine to something else such as DATE.VAR and 
  27. change the 'SHF SH' command to 'SHF DATE' at the beginning of the 
  28. alias.  The enclosed SH.VAR is my personal one and has all sorts 
  29. of other variables that I use, as do the other 7.  Feel free to 
  30. ask me what they're for but you can otherwise ignore them.
  31.  
  32. I suggest having the quiet flag on for this alias (mine is on 
  33. permanently).  Also, until someone updates SHFILE to be response 
  34. to this flag (it is not now), I suggest using my included version 
  35. of SHF.COM.
  36.  
  37.                               * * *
  38.  
  39. I thank Dreas Nielsen for the inspiration behind this particular 
  40. configuration of *.VAR files.  This concept of using VAR files to 
  41. determine the *name* (as opposed to its 'number') of day and 
  42. month when given a date is essentially similar to what I 
  43. described in my recent TCJ column, but it is implemented in a 
  44. radically different way thanks to a tip from Dreas Nielsen.  In 
  45. response to my column in which I mentioned I had 12 different 
  46. *.VAR files for each month of the year, as in 0189.VAR, 0289.VAR, 
  47. 0389.VAR ... 1289.VAR, Dreas commented that this scheme 
  48. is wasteful and necessitates having to change VAR files each 
  49. year.  He noted that a more flexible scheme would use a concept of
  50. 'perpetual calendar', in which the VAR files would be 
  51. based on day-of-week rather than month.  In this way they would 
  52. therefore be reusable.
  53.  
  54. Being an ecologist at heart, I immediately adopted this concept 
  55. and created a VAR file for each day of the week, in which the 
  56. correspondence scheme is that each of these can now perform for 
  57. every month that *begins* with the day of week after which the 
  58. VAR file is named.  SH.VAR, for its part, contains the entries to 
  59. reference any particular month to its corresponding VAR file.
  60.  
  61. shf sh
  62. if nu $1
  63. rs shf %$dm$dy
  64. rs echo t%>oday is%< %$dd, %$dm$dy $dd, 19$dy.^m^j
  65. else
  66. if ~nu $3
  67. rs shf %$1$3
  68. rs echo %$1$3 $2, 19$3 %>is a%< %$2.
  69. shf sh
  70. zif
  71.  
  72.  
  73. Let's follow the alias expansion assuming a date of March 16, 
  74. 1989 and we run DAY with no parameters.  SHFILE sets the VAR file 
  75. to SH, the default, in case it is not active (or rename SH.VAR to 
  76. something else and change the command accordingly if you already 
  77. use your own SH.VAR).  We then have 'RESOLVE SHFILE %0389'.  
  78. RESOLVE looks in SH.VAR and finds a shell variable named '0389' 
  79. which I have defined in it as 'WEDNESDAY'.  Using information 
  80. taken from 4 years of calendars I have programmed this data into 
  81. the various VAR files (you don't have to do it), simply observing 
  82. that March, 1989 begins on a Wednesday.  Therefore according to 
  83. our scheme, we want to use the set of definitions in 
  84. WEDNESDA.VAR.  All months from 1989 through 1992 have entries in 
  85. SH.VAR in this manner.
  86.  
  87. SHFILE now makes WEDNESDA.VAR active.  ARUNZ then gives us:
  88.  
  89. RESOLVE ECHO TODAY IS %16, %0389 16, 1989.
  90.  
  91. RESOLVE now looks in WEDNESDA.VAR for a variable named '16' and 
  92. finds that it is defined as 'THURSDAY'.  (Keep in mind that 
  93. Wednesday is only the day on which the month *begins* and is used 
  94. only to identify our VAR file; don't confuse it with the current 
  95. or specified day.)  It then looks in WEDNESDA.VAR for the same 
  96. variable which we had a moment ago, '0389'.  However this time 
  97. we are in a different VAR file and it therefore has an entirely 
  98. different definition, 'MARCH'.  We therefore get what we wanted:
  99.  
  100. ECHO TODAY IS THURSDAY, MARCH 16, 1989.
  101.  
  102. Similarly if parameters are entered, such as 'DAY 10 13 91'.  
  103. ARUNZ gives us 'RESOLVE SHFILE %1091', and RESOLVE looks in 
  104. SH.VAR and finds that the string variable '1091' is defined as 
  105. 'TUESDAY'.  SHFILE therefore sets the current file to TUESDAY.VAR
  106. ARUNZ then gives us:
  107.  
  108.               RESOLVE echo %1091 13, 1991 is a %13
  109.  
  110. RESOLVE looks in TUESDAY.VAR, finds that '%1091' is *there* 
  111. defined as 'OCTOBER' and '%13' is defined as 'SUNDAY', and we're 
  112. in business with:
  113.  
  114.                   OCTOBER 13, 1991 is a SUNDAY.
  115.  
  116.                               * * *
  117.  
  118. Thank you, Dreas -- I have not only decreased the number of VAR 
  119. files needed for these tasks from 12 to 7, but they are now valid 
  120. until 1993 (this is an arbitrary limit; it would take no time at 
  121. all to add more years) rather than every year.
  122.  
  123.  
  124. Rick Charnes, San Francisco, (415) 826-9448 voice
  125.  
  126. March 12, 1989
  127.