home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / vms / 15006 < prev    next >
Encoding:
Text File  |  1992-09-14  |  2.3 KB  |  66 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!gatech!concert!epa-rtp!ralph.rtpnc.epa.gov!rbn
  3. From: rbn@ralph.rtpnc.epa.gov (Bob Boyd)
  4. Subject: Re: Time Subtraction in DCL
  5. Message-ID: <1992Sep14.155206.15251@rtpnc.epa.gov>
  6. Sender: usenet@rtpnc.epa.gov
  7. Nntp-Posting-Host: ralph.rtpnc.epa.gov
  8. Organization: UNISYS/Environmental Protection Agency
  9. References: <14070256@zl2tnm.gen.nz>
  10. Date: Mon, 14 Sep 1992 15:52:06 GMT
  11. Lines: 53
  12.  
  13. don@zl2tnm.gen.nz (Don Stokes) writes:
  14. > 348588060@WILD.VILL.EDU (Dave Lennon) writes:
  15. > > Hi,
  16. > >     And if we haven't had enough of finding the last day of a month in 
  17. > > DCL...I seem to recall a while back someone had posted a DCL trivia question 
  18. > > on how to do date subtraction in DCL. I seem to remember it was using f$fao
  19. > > to peek at some memory locations...
  20. > I've already posted a yucky way to do this, which I recommend against
  21. > using....
  22. > >     The application I need this for is a backup procedure written entirely 
  23. > > in DCL (so why change now) where I would like to automatically figure out the 
  24. > > cycle letter based on how many weeks have past since the starting date...
  25. > Rather than attempting date subtraction, how about just testing if the 
  26. > date has reached a milestone -- for example, if you want to do a full 
  27. > backup every fourth week, use:
  28. >     $ today = f$cvtime(,"ABSOLUTE", "DATE")
  29. >     $ open/read/write datefile LASTFULL.DAT/error=oops
  30.  
  31. Another way to get the date is if you keep online journal files, you can
  32. find the journal file and get the timestamp from it by doing:
  33.     $ lastfull = f$file_attribute(journal_file,"CDT")
  34.  
  35. >     $ read datefile lastfull
  36.  
  37. I recommend a minor modification here -- 
  38.  
  39. For a lot of reasons I prefer to store dates in absolute format and do
  40. the conversion just before the comparison.
  41.  
  42. So I would add:
  43.         $ lastfull = f$cvtime(lastfull)
  44.  
  45. Since sometimes things go BUMP in the night and over the weekend,
  46. I like to frame comparisons in terms of "have I passed the time when?".
  47. So I would change the next line to use a .ges. comparison.
  48.  
  49. >     $ if f$cvtime(today + "-28-", "ABSOLUTE", "DATE") .eqs. lastfull
  50. >     $ then    write/update datefile today
  51. >     $     [do full backup]
  52. >     $ else    [do something else]
  53. >     $ endif
  54. >     $ close datefile
  55.  
  56. --
  57. Bob Boyd                 
  58. rbn@ralph.rtpnc.epa.gov 
  59. Unisys/EPA               
  60.  
  61.