home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / DAYNBR.ZIP / DAYNBR.DOC next >
Text File  |  1985-10-27  |  7KB  |  151 lines

  1.                               DAYNBR -- Version 1.0
  2.                          Copyright (c) 1985 by Ben Baker
  3.  
  4.            Released  for  free  non-commercial  use  and distribution.
  5.            Reasonable licensing arrangements for commercial use may be
  6.            made by contacting the author:
  7.  
  8.                   Ben Baker
  9.                   P.O. Box 425
  10.                   Godfrey, IL 62035
  11.  
  12.                   Fido 100/76
  13.  
  14. Purpose:   Edit  a  DOS  command  to  contain  reference(s)  to Julian
  15.            day-of-year, then execute the command.
  16.  
  17. Format:    DAYNBR [ /{D|+|-}<n> ] <command> <parameters>
  18.  
  19. Type:      External.
  20.  
  21. Remarks:   When multiple files containing similar data must coexist on
  22.            the  DOS  file system, they must have unique names.  If the
  23.            files are of a periodic nature, a natural naming convention
  24.            would   embed   the   creation   date  in  the  file  name.
  25.            "Day-of-year" number is  a  frugal  choice  since  it  only
  26.            requires  3  digits  and  can even be used as the file name
  27.            extension.
  28.  
  29.            When   periodic   maintenance  is  required  to  create  or
  30.            manipulate these files, the use of "wild-card" names may be
  31.            inconvenient  or  even  impossible,  precluding  the use of
  32.            batch files to do the work.
  33.  
  34.            This  program will calculate the correct day number, edit a
  35.            DOS command's parameters to contain the  day  number,  then
  36.            execute the command.
  37.  
  38.            The  <command>  to  be executed may be a batch file name or
  39.            any  internal  or  external  DOS   command   except   batch
  40.            conditional commands (eg.  IF).
  41.  
  42.            The  <parameters>  for  <command> contain one or more "edit
  43.            patterns" in the form:
  44.  
  45.                   @<ccc>
  46.  
  47.            The "at sign" (@) is  a  literal  lead-in  character  which
  48.            introduces  the  pattern,  and <ccc> is any string of three
  49.            characters.  Characters in the  pattern  other  than  pound
  50.            sign  (#) are copied as-is to the command parameter.  Pound
  51.            signs (#) are replaced by the corresponding  digit  of  the
  52.            calculated  day  number.   In  other  words,  if the second
  53.            character of the pattern is a pound sign  (c#c),  the  tens
  54.            digit  of  day  number  is  copied  to that position in the
  55.            parameter being edited.  This ability allows  you  to  deal
  56.            effectively with squeezed (#Q#) and archived (A##) versions
  57.            of the files.
  58.  
  59.            If an actual at sign is required in a prarmeter, it may  be
  60.            entered as two successive at signs (@@).  This may occur on
  61.            successive  invocations  of  DAYNBR,  for  example.    (See
  62.            example below.)
  63.  
  64.            When  DAYNBR  begins, it sets a "reference date" to today's
  65.            date.  If no optional  switches  appear  before  <command>,
  66.            DAYNBR  calculates  the day number for today and uses it in
  67.            editing.  The switches have the  effect  of  modifying  the
  68.            reference date used in editing.
  69.  
  70.            /+<n>  and  /-<n> add <n> days to or subtract <n> days from
  71.            the reference date respectively.  <n> may be any number  in
  72.            the  range  of 0 to 32767.  Note that the plus sign (+) MAY
  73.            NOT be omitted.  Unsinged <n> is reserved for  a  different
  74.            context in a possible future enhancement.
  75.  
  76.            /D<n>  selects  a  specific  day  of  the week from a 7-day
  77.            window ending with the current reference date  as  the  new
  78.            reference  date.  <n> must be a single digit in the range 0
  79.            to 6, and corresponds to the days Sunday through  Saturday.
  80.  
  81.            Switches  may  be  used in combination, and are interpreted
  82.            from left to right.
  83.  
  84.            DAYNBR  invokes  a  new  copy of the COMMAND.COM to execute
  85.            <command>.  Therefore COMMAND.COM must  be  in  either  the
  86.            current  directory,  or  a  directory  specified  in a PATH
  87.            command.
  88.  
  89.            Since the command processor does not pass  back  any  error
  90.            codes  returned  by  the  executed  program,  DAYNBR cannot
  91.            return  them  to  your  batch  file  for  testing.   DAYNBR
  92.            terminates  with  ERRORLEVEL = 1 if it encounters any error
  93.            while processing switches or edit patterns.   Otherwise  it
  94.            executes the <command> and returns ERRORLEVEL = 0.
  95.  
  96. Examples:  Most of the following examples use the ECHO command.   This
  97.            is an excellent way to excercize DAYNBR until you are fully
  98.            familiar with how it works because  results  are  immediate
  99.            and it can do nothing harmful.
  100.  
  101.            Display today's day number:
  102.  
  103.                 DAYNBR ECHO @###
  104.  
  105.            Display  the  most  recent  Friday's  day number (including
  106.            today if it's Friday):
  107.  
  108.                 DAYNBR /D5 ECHO @###
  109.  
  110.            Display the day number for  next  Saturday  (not  including
  111.            today if it's Saturday):
  112.  
  113.                 DAYNBR /+7 /D6 ECHO @###             or
  114.                 DAYNBR /D6 /+7 ECHO @###
  115.  
  116.            Display  the  occurring Sunday (today, if it's Sunday).  In
  117.            other words, pick Sunday  from  a  7-day  window  BEGINNING
  118.            today,  or  slid  the  normal  day-of-week window forware 6
  119.            days, then pick Sunday:
  120.  
  121.                 DAYNBR /+6 /D0 ECHO @###
  122.  
  123.            This  one's  cute.   Display today's day number and the day
  124.            number for a week ago.
  125.  
  126.                 DAYNBR DAYNBR /-7 ECHO @### @@###
  127.  
  128.            Here DAYNBR edits today's day number into the first pattern
  129.            and removes one at sign from the second pattern.   It  then
  130.            invokes  itself  and edits the only remaining pattern using
  131.            the /-7 switch for a week ago.
  132.  
  133.            Each  recursive invocation of DAYNBR places another copy of
  134.            COMMAND.CON and DAYNBR.COM in memory.  The  only  limit  is
  135.            the amount of memory you have available.
  136.  
  137.            Here's a real world example.  The Fido node list is created
  138.            each  Friday  and  distributed  on  Saturday in an ARC file
  139.            named NODELIST.Ann, where nn is  the  last  two  digits  of
  140.            Friday's day number.  If today is Friday, you will not have
  141.            received today's node list yet, so unpack the  most  recent
  142.            node list:
  143.  
  144.                 DAYNBR /-1 /D5 ARC E NODELIST.@A## NODELIST.@###
  145.  
  146.                                       -----
  147.  
  148.                                 Revision History
  149.  
  150.  V1.0      10/27/85 - Basic release.
  151.