home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / os2 / dates2a.arj / DATES.DOC < prev   
Encoding:
Text File  |  1992-03-03  |  16.2 KB  |  442 lines

  1.                             DATES
  2.      Edit Dates/Times into a Command Line & Execute It.
  3.                    Release 2a - March 1992
  4.            Copyright (C) 1990-1992 by Graham Stair
  5.  
  6.  
  7.  
  8. Introduction
  9.  
  10. DATES is an enhanced replacement to Ben Bakers DAYNBR. It came about 
  11. because I needed to put more than just the Julian day in my command 
  12. line, and I needed it in the OS/2 environment as well as the DOS 
  13. environment.
  14.  
  15. DATES enhancements over DAYNBR are...
  16.  
  17.      It passes the return code back from the command line.
  18.      It has extra date and time edit strings.
  19.      Distributed with versions to run under OS/2 or DOS.
  20.      Uses the COMSPEC environment variable.
  21.      Logs elapsed time, return code and command line.
  22.                                                  
  23.  
  24.  
  25. License Information
  26.  
  27. DATES is a FREELY AVAILABLE package, available along similar lines 
  28. as BinkleyTerm and it's source. If you would like the source code to 
  29. DATES, please contact me. The source is free and ONLY available 
  30. DIRECT from me at your cost.
  31.  
  32. DATES and it's source code are NOT public domain, you can NOT make 
  33. changed copies available for anybody else without my permission. Any 
  34. source changes should be re-directed back to me for possible use in 
  35. future versions of DATES.
  36.  
  37. Please contact me data at ...
  38.  
  39. 3:711/409.0    +61-2-498-9184
  40.  
  41. or snail mail at ...
  42.  
  43. Graham Stair
  44. P.O.Box 99
  45. Pymble NSW 2073
  46. Australia
  47.  
  48. Table of Contents
  49.  
  50.  
  51. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
  52.  
  53. LICENSE INFORMATION  . . . . . . . . . . . . . . . . . . . . . . . 1
  54.  
  55. TABLE OF CONTENTS  . . . . . . . . . . . . . . . . . . . . . . . . 1
  56.  
  57. PACKAGING  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
  58.  
  59. USAGE: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
  60.    Explanation of {options}.   . . . . . . . . . . . . . . . . . . 2
  61.    Edit strings in COMMAND {parameters}  . . . . . . . . . . . . . 4
  62.       Date replacements  . . . . . . . . . . . . . . . . . . . . . 4
  63.       Time replacements  . . . . . . . . . . . . . . . . . . . . . 4
  64.       Miscellaneous replacements . . . . . . . . . . . . . . . . . 4
  65.  
  66. ENVIRONMENT VARIABLES  . . . . . . . . . . . . . . . . . . . . . . 5
  67.  
  68. EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
  69.  
  70. COMPATIBILITY WITH DAYNBR. . . . . . . . . . . . . . . . . . . . . 6
  71.    Incompatibilities . . . . . . . . . . . . . . . . . . . . . . . 7
  72.    Enhanced Incompatibilities  . . . . . . . . . . . . . . . . . . 7
  73.  
  74. OTHER PROGRAM OFFERINGS  . . . . . . . . . . . . . . . . . . . . . 7
  75.  
  76. HISTORY  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
  77. Packaging
  78.  
  79. The following files should be in your DATESxx archive.
  80.  
  81. DATES-R.EXE    DOS Real mode version of DATES.
  82. DATES-P.EXE    OS/2 Protected mode version of DATES.
  83. DATES.DOC      This documentation.
  84.  
  85.  
  86. Usage:
  87.  
  88.      DATES {options} COMMAND {parameters}
  89.          
  90.  
  91. Explanation of {options}. 
  92.      /+nnn     Add <nnn> days to the reference date.
  93.  
  94.      /-nnn     Subtract <nnn> days from the reference date.
  95.  
  96.      <nnn> may be any decimal number from 0 to 32 thousand 
  97.      something. Although in practice the dates are limited to the 
  98.      range 1st Jan 1980 to 18th Jan 2038.
  99.  
  100.      /Dn       Select a specific day <n>.
  101.  
  102.                <n> is a single digit which selects a specific day on 
  103.                or prior to the reference date. The digits are as 
  104.                follows...
  105.                     0 .. Sunday
  106.                     1 .. Monday
  107.                     2 .. Tuesday
  108.                     3 .. Wednesday
  109.                     4 .. Thursday
  110.                     5 .. Friday
  111.                     6 .. Saturday   
  112.  
  113.      The reference date starts out as the system date. Multiple 
  114.      {options} can appear and are processed left to right, each 
  115.      modifying the previous reference date in it's own way.
  116.  
  117.      /F<file>  Set the reference date to the <file>s date.
  118.  
  119.                This allows the reference date to be modified to a 
  120.                particular files date/time.
  121.         
  122.      /C        Force use of COMSPEC environment variable.
  123.  
  124.                This option forces DATES to invoke the COMMAND by 
  125.                directly calling the operating systems command 
  126.                processor (pointed to by the COMSPEC environment 
  127.                variable).
  128.  
  129.                If this option isn't used, DATES first tries to 
  130.                execute COMMAND by by-passing the command processor. 
  131.                If the COMMAND isn't executed correctly, it then uses 
  132.                the command processor.
  133.  
  134.                You would use this option in the cases where DATES 
  135.                does not execute the command correctly without going 
  136.                through the command processor. Note, this option 
  137.                takes additional memory as the command processor is 
  138.                being loaded no matter what.
  139.                                                                  
  140.      /Jc       Override DATES edit character to <c>.
  141.  
  142.                This lets DATES use any character as the edit 
  143.                character in place of ` code. Some command processors 
  144.                (4DOS) and/or environments (DESQVIEW) use the default 
  145.                edit character, this is one way to use DATES within 
  146.                these environments.
  147.  
  148.      /L<file>  Send log information to <file>.
  149.  
  150.                This will override the environment variable, so any 
  151.                log information can be written directly to <file>.
  152.  
  153.      /Q        Quiet mode.
  154.  
  155.                This suppresses the copyright information displayed 
  156.                when DATES is run, allowing a clutter free screen.
  157.  
  158.      /R        Force reported return code to zero.
  159.                                                                  
  160.                Unconditionally set the returned code reported to the 
  161.                log to zero. This does not change the actual return 
  162.                code reported to the operating system.
  163.  
  164.      /In       Ignore return code <n> as an error.
  165.  
  166.                When a return of <n> is returned by the sub-process, 
  167.                do NOT put an exclamation (!) in the log. If the 
  168.                return code is <n>, DATES will put a hash (#) 
  169.                instead. This is so any programs that report on the 
  170.                log and looks for an exclamation as an error, won't 
  171.                report <n> as an error.
  172.  
  173.                Up to ten separate /I's can be used at once.
  174.  
  175.      /Pp       Run the sub-process at priority <p>.
  176.                                                    
  177.                This is an OS/2 ONLY facility.
  178.  
  179.                This will run the sub-process at one of the four 
  180.                possible priority levels <p> within OS/2. The levels 
  181.                are..
  182.                     i : Idle          (slowest)
  183.                     r : Regular       (default)
  184.                     f : Fixed-High
  185.                     t : Time-Critical (fastest)
  186.  
  187.      /V        Verbose log.
  188.  
  189.                This will log the starting date/time of a command and 
  190.                the command being executed to the log.
  191.  
  192.      /?        Help screen.
  193.  
  194.  
  195. These options can be preceded with either a slash (/) or a dash (-). 
  196. This means that you could have two dashes in a row, this is OK. For 
  197. example the option /-100 could also be used as --100.
  198.  
  199.  
  200. Edit strings in COMMAND {parameters}
  201.  
  202. COMMAND {parameters} is any string with DATES edit strings, which 
  203. after replacement is converted to a valid operating system command. 
  204.  
  205. The COMMAND and {parameters} can contain the following edit strings. 
  206. These edit strings will be replaced with the date and time 
  207. information of the reference date as indicated here, then the new 
  208. COMMAND {parameters} will be passed to the operating system for 
  209. execution.
  210.  
  211. The default edit code, ` (ASCII 096), and it's one character 
  212. identifier (of which the case is irrelevant), are not moved to the 
  213. new COMMAND line. Each of the hashes (#) are converted and take up 
  214. exactly one spot in the final COMMAND line. They are zero filled on 
  215. the left if need be. The at symbol (@), can be used in place of the 
  216. `0 for the Julian date only.
  217.      
  218.  
  219. Date replacements
  220.  
  221.      `0### or @###  Julian day of the year (000 - 366).
  222.      `1####         Year, including century 
  223.                     (1980 - 2038).
  224.      `2##           Year, excluding century (80 - 38). 
  225.      `3##           Month (01 - 12).
  226.      `4###          First 3 characters of the month 
  227.                     name (JAN .. DEC).
  228.      `5##           Day of month (01 - 31).
  229.      `6###          First 3 characters of the day name.
  230.             
  231. Time replacements
  232.  
  233.      `A##           System hour (00 - 23).
  234.      `B##           System minute (00 - 59).
  235.      `C##           System seconds (00 - 59).
  236.      `D#####        System seconds since midnight 
  237.                     (00000 - 86400).
  238.      `E########     Seconds since midnight of 1st of Jan
  239.                     of the reference year (00000000 - 31622400).
  240.  
  241. Miscellaneous replacements
  242.  
  243.      `H#            The half of the year (1 or 2).
  244.      `Q#            The quarter of the year (1 - 4).
  245.      `T#            The Third of the year (1 - 3).
  246.      `S#            The sixth of the year (1 - 6).
  247.      `W##           The week of the year (1 - 53).
  248.  
  249. If you want to use the edit character ` (ASCII 096, 0x60) or @ 
  250. without it being interpreted as an edit string, put two of them 
  251. together (I.E. `` or @@). Any non #'s in any of the edit strings, in 
  252. any position, will NOT be replaced.
  253.  
  254. The /+nnn, /-nnn and /Dn options will not affect the `A, `B, `C, and 
  255. `D edit strings, as these are relative to midnight of the system 
  256. date and thus don't change when a day changes.
  257.  
  258. First DATES tries to execute your modified COMMAND by using normal 
  259. operating system procedures to find the command. I.E. looking in the 
  260. current directory and then checking down the paths in the PATH 
  261. environment variable. If the COMMAND is not found, DATES tries to 
  262. execute it once again by pre-pending the COMSPEC environment 
  263. variable to the command and running that. If the command is still 
  264. not found or the COMSPEC variable isn't declared then an error is 
  265. produced.
  266.  
  267.  
  268.  
  269. Environment Variables
  270.  
  271. DATES uses up to two environment variables. They are..
  272.  
  273. COMSPEC        This points to your command processor, 
  274.                and is required to be set.
  275.                
  276. Only the FIRST of the following environment variables will be used. 
  277. Each points to a log filename. If one of these is defined, one line 
  278. containing the elapsed time (et), return code (rc) and command line 
  279. (cl) executed is logged to the file. If none are define, no logging 
  280. is done.
  281.  
  282. DATES.LOG      {drive}{path}filename{.ext}
  283. OPUS.LOG       {drive}{path}filename{.ext}
  284. BBS.LOG        {drive}{path}filename{.ext}
  285.  
  286. The {drive}, {path} and {.ext} are optional. If you leave out 
  287. {drive} and {path}, remember, your COMMAND line may change the 
  288. current drive and/or directory, thus leaving filename's created all 
  289. over your disk(s).
  290.  
  291. This log file can be overridden by using the /L option explained 
  292. above.
  293.  
  294. Examples
  295.  
  296.      DATES ECHO `0###     ..or..     DATES ECHO @###
  297.  
  298. This will echo the current Julian day of the year to the screen. If 
  299. you want the look at the most recent Sundays Julian day number you 
  300. would add a /D0 between DATES and ECHO. The @ edit character can 
  301. ONLY be used for getting the julian day, it is included in DATES for 
  302. compatibility with DAYNBR.
  303.  
  304.  
  305.      DATES /+1000 /D4 ECHO `6### `1####/`3##/`5## `a##:`b##:`c##
  306.  
  307. The above command will first get the system date, add 1000 days to 
  308. it (/+1000), then find the most recent Thursday (/D4). Then it will 
  309. produce something like this 'Thu 1993/02/11 17:50:23'
  310.  
  311.  
  312.      DATES /+10 /D5 /-10 ECHO `2##/`0###
  313.  
  314. This will add 10 days (/+10) onto the system date, find the most 
  315. recent Friday then take 10 days off (/-10) this date. This is 
  316. different to /+10 /-10 /D5, try it!
  317.  
  318.  
  319.      DATES /J~ /Lc:\dates.log RENAME USERS.TXT USERS~H#.TXT
  320.  
  321. This will rename the file USERS.TXT to either USERS1.TXT or 
  322. USERS2.TXT, depending on whether the reference date is prior to, or 
  323. after the 1st of July. The /J~ allows the use of the ~ character in 
  324. the edit string in place of the default character of `. The command, 
  325. elapsed time and return code will be written to a log file 
  326. c:\dates.log.
  327.  
  328.  
  329.      DATES /Fc:\command.com ECHO COMMAND.COM's julian day is `0###
  330.  
  331. This will display the julian day (of the last modification) of the 
  332. file COMMAND.COM in the root drive of the C: drive. All the other 
  333. reference date modifiers could also be use in conjunction with the 
  334. /F option. 
  335.  
  336.  
  337.      DATES DAY`6###
  338.  
  339. This command will execute files called DAYSUN, DAYMON, DAYTUE, 
  340. DAYWED, DAYTHU, DAYFRI, DAYSAT on their respective days.
  341.  
  342.  
  343.      DATES /-7 DATES DATES /+7 ECHO `0A## ``0#B# ````0##C
  344.  
  345. This will show something like this 
  346.      A37 1B4 15C
  347.  
  348.  
  349.      DATES /Q RENAME bbs.log `E########.log
  350.  
  351. This will rename bbs.log to the number of seconds since the new 
  352. year. The /Q option will suppress any output generated by DATES, but 
  353. not the RENAME command.
  354.  
  355. Compatibility with DAYNBR.
  356.  
  357. First, a big thanks to Ben Baker for producing DAYNBR V1.0 back in 
  358. 1985. I just out grew it... with DATES the results. These 
  359. incompatibilities are due to MS C limitations. If you currently 
  360. don't use any of the problems and features below, you can copy DATES 
  361. to DAYNBR and start using it straight away.
  362.  
  363.  
  364. Incompatibilities
  365.  
  366. DAYNBR can handle dates +/- 32 thousand something from the current 
  367. date. DATES works in the range 1 Jan 1980 - 18 Jan 2038.
  368.  
  369. DAYNBR can have straight double quotes (") in it's <parameters>. 
  370. DATES needs a \ (back-slash) if you want the literal double quote 
  371. (").  I.E.
  372.  
  373.      DATES /D5 FIND \";A\" NODELIST.`0###
  374.  
  375. will find all occurrences of ;A in the current nodelist. 
  376.                                                   
  377.  
  378. Enhanced Incompatibilities
  379.  
  380. The following "incompatibilities" are due to my enhancements over 
  381. DAYNBR.
  382.  
  383. DATES uses the ` (ASCII 096) character as an edit string enabler. If 
  384. you want to use this character normally, double it up.
  385.  
  386. DATES returns the return code (for testing with the ERRORLEVEL batch 
  387. facility) of the COMMAND it executed.
  388.  
  389. Your COMSPEC environment variable is REQUIRED to be defined (and 
  390. pointing to your command processor) under DATES. DAYNBR has 
  391. COMMAND.COM hard coded into it's code, thus requiring COMMAND.COM to 
  392. be in the path.
  393.  
  394. Some programs that run under DAYNBR, won't run under DATES. This is 
  395. usually because the programs don't like being called directly by 
  396. DATES. Try using the /C option to go through the command processor 
  397. in these cases. I have found only one program that requires this 
  398. option so far, that is, IBM's PS2TAPE V1.11 program for DOS.
  399.                  
  400.       
  401. Other Program Offerings
  402.                                                          
  403. The following program offerings are other software developed by 
  404. myself. If you would like any of them please contact me.
  405.  
  406. GOOSE     On-line password checker/changer/enforcer for OPUS 1.0x, 
  407.           OPUS 1.1x and MAXIMUS 1.0x. (DOS)
  408. LOGS      Split and/or Merge OPUS/BINK style log files. (DOS and 
  409.           OS/2)
  410. RECURR    Schedule recurring events. (DOS)
  411. LOGMSG    Log messages (incl disk space) to an OPUS/BINK style log. 
  412.           (DOS and OS/2)
  413. MSG       Report on statistics of a message area, IE, who 
  414.           contributes and by how much. (DOS and OS/2)
  415.  
  416.  
  417.  
  418. History
  419.  
  420. 23 May 90 - Release 1a beta
  421.   -  Released for limited testing.
  422.  
  423. 03 Jun 90 - Release 1a
  424.   -  Added /C Option.
  425.  
  426. 17 Dec 90 - Release 1b
  427.   -  Added /Q, /R and /I options.
  428.   -  Decreased memory usage from around 80KB to around 30KB.
  429.   -  Moved log processing (open/write/close) until after the 
  430.      sub-process has executed. This allows sub-processes that access 
  431.      the log to do so without it being open, such as a backup.
  432.   -  Compiling now with MS C V6.00, which produces smaller faster 
  433.      code.
  434.  
  435. 23 Jun 91 - Release 2a
  436.   -  Added /F, /L and /J options. The /J option was added for 4DOS & 
  437.      DESQVIEW users. 4DOS & DESQVIEW uses the ` character as a 
  438.      quote, with the /J option, you can set the edit character to 
  439.      anything you like.
  440.   -  Added `H#, `Q#, `T#, `S# and `W## edit strings.
  441.   -  Added /P option to the OS/2 version.
  442.