HP OpenVMS Systems

ask the wizard
Content starts here

Touch utility? (file revision dates)

» close window

The Question is:

 
I'd like to write a version of the UNIX "touch" utility using RMS calls in
OpenVMS.  (touch allows you to change the date/timestamp on an existing
file.)  It looks like the XABDAT block has the data I'm after, and there is
a chunk of sample (assembler) co
de in the manual (P-6B).  I'm not an assembler guy; I have to do it in C.
 
I have looked at wiz_2821 ("C & RMS"), and it seems like that doesn't quite
have what I'm after -- it only reads the timestamp in the XAB$Q_CDT field,
and the manual says that field isn't writable.  If it's writable, how is
that done in C?
 
Or, on a wild alternative: is there a VMS version of the UNIX C library call
utime(), which seems to be the call that does the heavy lifting in "touch"?
(I got a copy of the "touch" source from the GNU project.)
 
The purpose of all this is Y2K-testing-related: our development system is
going to be the "permanent" testing system between now and 1/1/00, and while
it's going to have next year as the system date, files will be created there
and moved to our production
 system (with the normal sysdate), with the inevitable confusion of "which
file is really the current one?".
 
thanks in advance...
 
 


The Answer is :

 
  Consider using DFU, a tool that is part of the OpenVMS Freeware.
  The DFU tool has a command to achieve exactly this end:
 
    DFU SET /CREATE
 
  RMS does not allow you to directly set the Creation date.  You can
  use the XAB$Q_RDT field in the XABRDT as input to a $CLOSE to change
  the REVISION date for a write accessed file to a user provided value
  (or to the current time and date when none is provided).
 
  At a lower level -- if you wish to implement this yourself -- the use
  of the XQP interface is likely required.  You would use a sys$qio call
  with an IO$_ACPCONTROL function to change this through attribute
  ATR$C_CREDATE.  This particular interface is described (in detail) in
  the OpenVMS I/O User's Reference Manual.
 
  A C example of working with the related ATR$C_*DATE itemcodes is
  included in the FLISTFRONTEND directory, in module ACPLOOK.C, on
  the OpenVMS Freeware.  The Freeware also appears to have utilities
  similar to touch (lookalikes) in the [KRONOS] and [RCS] directories.
 

answer written or last revised on ( 18-OCT-1999 )

» close window