home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!gatech!concert!epa-rtp!ralph.rtpnc.epa.gov!rbn
- From: rbn@ralph.rtpnc.epa.gov (Bob Boyd)
- Subject: Re: Time Subtraction in DCL
- Message-ID: <1992Sep14.155206.15251@rtpnc.epa.gov>
- Sender: usenet@rtpnc.epa.gov
- Nntp-Posting-Host: ralph.rtpnc.epa.gov
- Organization: UNISYS/Environmental Protection Agency
- References: <14070256@zl2tnm.gen.nz>
- Date: Mon, 14 Sep 1992 15:52:06 GMT
- Lines: 53
-
- don@zl2tnm.gen.nz (Don Stokes) writes:
- > 348588060@WILD.VILL.EDU (Dave Lennon) writes:
- > > Hi,
- > > And if we haven't had enough of finding the last day of a month in
- > > DCL...I seem to recall a while back someone had posted a DCL trivia question
- > > on how to do date subtraction in DCL. I seem to remember it was using f$fao
- > > to peek at some memory locations...
- >
- > I've already posted a yucky way to do this, which I recommend against
- > using....
- >
- > > The application I need this for is a backup procedure written entirely
- > > in DCL (so why change now) where I would like to automatically figure out the
- > > cycle letter based on how many weeks have past since the starting date...
- >
- > Rather than attempting date subtraction, how about just testing if the
- > date has reached a milestone -- for example, if you want to do a full
- > backup every fourth week, use:
- >
- > $ today = f$cvtime(,"ABSOLUTE", "DATE")
- > $ open/read/write datefile LASTFULL.DAT/error=oops
-
- Another way to get the date is if you keep online journal files, you can
- find the journal file and get the timestamp from it by doing:
- $ lastfull = f$file_attribute(journal_file,"CDT")
-
- > $ read datefile lastfull
-
- I recommend a minor modification here --
-
- For a lot of reasons I prefer to store dates in absolute format and do
- the conversion just before the comparison.
-
- So I would add:
- $ lastfull = f$cvtime(lastfull)
-
- Since sometimes things go BUMP in the night and over the weekend,
- I like to frame comparisons in terms of "have I passed the time when?".
- So I would change the next line to use a .ges. comparison.
-
- > $ if f$cvtime(today + "-28-", "ABSOLUTE", "DATE") .eqs. lastfull
- > $ then write/update datefile today
- > $ [do full backup]
- > $ else [do something else]
- > $ endif
- > $ close datefile
- >
-
- --
- Bob Boyd
- rbn@ralph.rtpnc.epa.gov
- Unisys/EPA
-
-