Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

HP OpenVMS Systems

ask the wizard
Content starts here

DCL lexicals, time, and f$cvtime?

» close window

The Question is:

 
In DCL, how do you compare file time/date stamps? Using the F$FILE_ATTRIBUTES
 lexical, I'm trying to write a DCL program to compare the time/date stamps of
 two files (with different names)to see which one is newer.
 
 


The Answer is :

 
  The f$cvtime lexical function provides a conversion to a time format
  suitable for comparision using the standard DCL string operators.
 
  For details on DCL programming, please see the OpenVMS User's Guide
  and the Writing Real Programs in DCL book.
 
  In this case, the lexical function f$cvtime returns time strings in
  either ABSOLUTE or COMPARISON format.   COMPARISON is the default.
 
  $ write sys$output f$cvtime(f$file_attributes("login.com","RDT"))
    2001-10-19 04:43:33.02
  $ write sys$output f$cvtime(f$file_attributes("login.com","RDT"),"comparison")
    2001-10-19 04:43:33.02
  $ write sys$output f$cvtime(f$file_attributes("login.com","RDT"),"absolute")
    19-OCT-2001 04:43:33.02
 
 
  $ IF F$CVTIME(F$FILE("F1.DAT","CDT")) .GTS. F$CVTIME(F$FILE("F2.DAT","CDT"))
  $ THEN
  $!  F1.DAT has a more recent creation date
  $ ELSE
  $!  F2.DAT has a more recent creation date
  $ ENDIF
 
 

answer written or last revised on ( 26-NOV-2001 )

» close window

 

** About PDF files: The PDF files on this Web site can be read online or printed using Adobe® Acrobat® Reader. If you do not have this software installed on your system, you may download it from Adobe's Web site
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.