[comp.os.vms] file dates.

IJAH400@INDYVAX.BITNET (02/09/88)

<   I am not very familiar with VAXen to say if it is possible to set the
< date stored with each file.  Oh, if I am not mistaken, when you do a
< dir /date=some date, it is not necessarily the creation date, but rather
< the date it was last modified.
<
<   In any case, it doesn't make much sense to want to change a file's dates.
< Why would anyone want to do such a thing?

Well, the dates are just stored in the file header (try DUMP/HEADER/BLOCK=
COUNT=0 filespec) so I suppose one could change them to anything he/she
pleases by rewriting that.  This of course presupposes that one (1) knows
where the file header is (2) knows what it looks like (3) can write a
program to rewrite it and (4) has the <deleted> to try it out.

The civilized method would be to make a copy of the file using RMS, and
set the dates to be what you want when you call the RMS $CREATE service.
You can override the default dates when you do a $CREATE by using the
Date and Time XAB (XABDAT).  See section 9 of your RMS manual for details.
The XABDAT control block is only used as *input* to the $CREATE service,
so it *appears* that there is no civilized way of doing it to an existing
file without making a copy of it.

Why change dates (or supply non-default dates on a create)?  Well, aside
from non-serious applications (like logging in on April 1 and finding a
disk copy of the Gettysburg address dated 1863) the most important use for
it I have seen is with BACKUP restores (BACKUP preserves the original
file dates when restoring).  From time to time, DEC will provide you with
other reasons you might want to dink with dates; like, when last September,
we updated our console software.  An innocuous line in the release notes
warned that we'd have to reset the system date/time after we rebooted.
They didn't mention that it was going to come up with a date two weeks in
the future.  Our nightly batch job went off and wreaked some date havoc.
Moral: Set everything in the queues on hold before going down for a
software update.

I just got a hat stuck on my head last June to play VAX systems programmer,
all my previous experience was with -10s and -20s.  So please let me know
if I say something that is (1) dumb (2) incorrect (3) etc.  On TOPS-20 we
had a little utility called REV for doing things like date-dinking.  Anyone
know of any such utility for VMS?

James A. Harvey                         Bitnet: IJAH400@INDYVAX
DEC Systems Group
IUPUI Academic Computing Services
Engineering & Technology 1023
799 W. Michigan St.
Indianapolis, IN.  46220

IJAH400@INDYVAX.BITNET (02/10/88)

< Well, I lost the original question.  It was about changing file dates.

I should have looked around more about this one (I sent a reply that
probably wasn't very helpful).  Rather than grunging through the RMS manual
and writing a program, you can do it very simply with the FDL editor:

1.      Make an FDL for the file you want to change.

2.      Get into the FDL editor: EDIT/FDL fdl-filespec

3.      Select Add from the Main Menu.

4.      Select DATE from the Legal Attributes Menu.

5.      Pick the date you want to change (BACKUP, CREATION, EXPIRATION,
        or REVISION).  Set it to what you want.  If you want to set
        more than one date you'll have to wade through all the menus
        again.  When you wade back down, you won't see the dates you
        set (in the date-type menu), but they are still there and will
        be applied when the FDL is used with CONVERT to create a file.
        The FDL Editor will re-list the dates correctly every time you
        change one.

6.      Use CONVERT to make a new copy of the file with the dates you
        want.  This file will have the dates you set.

One thing to be aware of: ANALYZE/DISK_STRUCTURE will complain about
files with wierd dates (like creation dates in the future) and want to
fix them.  There IS a reason to fudge with dates once in a while, like
the time, after an upgrade, when our system came up with a date two
weeks in the future!

James A. Harvey                         Bitnet: IJAH400@INDYCMS
IUPUI Computing Services
ET 1023
799 W. Michigan St.
Indianapolis, IN  46220

-       Gee, there IS a reason for DIR/CREATED/SINCE=TOMORROW  !

dhesi@bsu-cs.UUCP (Rahul Dhesi) (02/15/88)

Thanks to all who made suggestions.  The article I'm responding to (by
James Harvey) shows how to change file dates using FDL;  however, I
need to do it from a C program.  I also received helpful replies from
u3369429@ucsvc.dn.mu.oz.au (Michael Bednarek) and David Robinson
<david@elroy.Jpl.Nasa.Gov>.  The last-named sent me a small C program
that shows how to set file dates and times from a C program using QIO.
This seems to be just what I need.  The purpose is to let my zoo
archive program restore file dates when it extracts them.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi

ERIC@UOFT02.BITNET (Eric) (02/16/88)

In-Reply-To:  your letter rec'd 14-FEB-1988 11:54

From:   IN%"INFO-VAX@KL.SRI.COM" 14-FEB-1988 11:54
To:     Eric Rostetter <ERIC@UOFT02>
Subj:   Re: file dates.

> Well, the dates are just stored in the file header (try DUMP/HEADER/BLOCK=
> COUNT=0 filespec) so I suppose one could change them to anything he/she
> pleases by rewriting that.  This of course presupposes that one (1) knows
> where the file header is (2) knows what it looks like (3) can write a
> program to rewrite it and (4) has the <deleted> to try it out.

Sounds right but I can't say for sure...

> The civilized method would be to make a copy of the file using RMS, and
> set the dates to be what you want when you call the RMS $CREATE service.
> You can override the default dates when you do a $CREATE by using the
> Date and Time XAB (XABDAT).  See section 9 of your RMS manual for details.

This is 100% right but not the best way...

> The XABDAT control block is only used as *input* to the $CREATE service,
> so it *appears* that there is no civilized way of doing it to an existing
> file without making a copy of it.

The best way is to use FDL and CONVERT.  It is then extreamly easy to change
the date/time of any existing file.   There was also a program that was sent
out on INFO-VAX a while ago called FILE.C that could change the date/time of
a file.  For more information on FDL and CONVERT,  see the VAX/VMS Utilities
Reference Manual, or type HELP CONVERT, HELP FDL, and HELP EDIT.  The FILE.C
program was sent by Joe Meadows Jr., Fred Hutchinson Cancer Research Center,
bitnet - JOE@FHCRCVAX, arpa - JOE%FHCRCVAX.BITNET@WISCVM.WISC.EDU,  or voice
(206) 467-4970.

Eric Rostetter
Eric @ uoft02.bitnet