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
  $ THEN
  $!  F1.DAT has a more recent creation date
  $ ELSE
  $!  F2.DAT has a more recent creation date

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

» close window