Article 137334 of comp.os.vms:
Path: nntpd.lkg.dec.com!depot.mro.dec.com!pa.dec.com!decuac.dec.com!haven.umd.edu!news.umbc.edu!eff!news.duke.edu!news.mathworks.com!newsfeed.internetmci.com!news.msfc.nasa.gov!elroy.jpl.nasa.gov!lll-winken.llnl.gov!fnnews.fnal.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: Changing File Revised Date to = Created Date
Date: 7 Jan 1996 02:29:57 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 74
Distribution: world
Message-ID: <4cnb75$462@gap.cco.caltech.edu>
References: <4cjthk$2kv@hudson.lm.com>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
NNTP-Posting-Host: sol1.gps.caltech.edu

In article <4cjthk$2kv@hudson.lm.com>, lawfirm@dmc-law.com (P. Santos) writes:
=
=Due to "an inadvertant error," we need to change the values on most of 
=our files in the revised date parameter to equal the created date.  The 
=revised date currently holds the same date for almost all of the 
=affected files.  This occurred when someone changed the protection on 
=all of these files.  While this normally wouldn't be a problem, under 
=Pathworks DOS is reporting all of the files according to their 
=VMS Revised Date and not their Created Date. Thus, the need to change 
=the Revised Date parameter to equal the Created Date value.
=	I am no expert on VMS, so this may be quite basis (although I 
=couldn't figure out how to do it using the Set command).  On the other 
=hand, it may require a short DCL script.  Any suggestions would be 
=appreciated.

Actually, the way I'd do it is with a C program calling the RMS functions
SYS$OPEN and SYS$CLOSE, as follows:

#include stdio
#include descrip
#include RMS
#include string
#define ckstat(x) if(((stat = x) & 7) != 1) SYS$EXIT(stat)
#define _DESCRIPTOR_D(name)	struct dsc$descriptor_d name = \
	{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 }

main(int nargs, char **args)
{	unsigned long stat, context, SYS$OPEN(), SYS$CLOSE(), SYS$EXIT(),
		LIB$FIND_FILE(), LIB$PUT_OUTPUT();
	struct FAB my_fab;
	struct XABRDT my_xabrdt;
	struct XABDAT my_xabdat;
        $DESCRIPTOR(filespec, "");
	_DESCRIPTOR_D(result);

	if (nargs != 2)
	{	puts("Usage:  FIXTIME filespec");
		SYS$EXIT(1);
	}
/* Initialize parameters for LIB$FIND_FILE */
	context = 0;
	filespec.dsc$a_pointer = *++args;
	filespec.dsc$w_length = strlen(*args);
	puts("Updating the following files:");
/* Loop until no more files matching [possibly wild-carded] filespec */
	while(((stat = LIB$FIND_FILE(&filespec, &result, &context)) & 7) == 1)
	{	LIB$PUT_OUTPUT(&result);
/* Set up RMS structures for call to SYS$OPEN */
		my_xabdat = cc$rms_xabdat;
		my_fab = cc$rms_fab;
		my_fab.fab$l_fna = result.dsc$a_pointer;
		my_fab.fab$b_fns = result.dsc$w_length;
		my_fab.fab$l_xab = (char *) &my_xabdat;
/* Tell RMS we plan to update the file */
		my_fab.fab$b_fac = FAB$M_PUT;
		ckstat(SYS$OPEN(&my_fab));
/* Now set up RMS structures for call to SYS$CLOSE */
		my_fab.fab$l_xab = (char *) &my_xabrdt;
		my_xabrdt = cc$rms_xabrdt;
/* Copy the creation date from XABDAT to the revision date in XABRDT */
		my_xabrdt.xab$q_rdt = my_xabdat.xab$q_cdt;
/* And update the dates by closing the file */
		ckstat(SYS$CLOSE(&my_fab));
	}
	SYS$EXIT(stat);
}
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.


