[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

DCL symbols and string handling?

» close window

The Question is:

 
 
The DCL calls:
$ sho time
  29-MAR-2000 10:04:06
$ write sys$output
 "/",f$cvtime("today+4",,"HOUR"),"/",f$cvtime("today"+4,,"HOUR"),"/"
/04/05/
 
Why this 1 hour difference? How is f$cvtime("today"-1) translated?
I expected yesterday's 23:00:00.00.
 
More:
$ write sys$output
 "/",f$cvtime("today-1",,"HOUR"),"/",f$cvtime("today"-1,,"HOUR"),"/"
/23/00/
$ write sys$output
 "/",f$cvtime("today-1",,"HOUR"),"/",f$cvtime("today"-2,,"HOUR"),"/"
/23/09/
 
Does format  like f$cvtime("today"-1) means that I get en unpredictible result?
 
 


The Answer is :

 
  Does the following simplification of the behaviour help you understand
  what is going on here?
 
$ x = "/" + "today" + 4 + "/"
$ show symbol x
  X = 4   Hex = 00000004  Octal = 00000000004
$ write sys$output "''f$type(x)'"
INTEGER
$ x = "/" + "today+4" + "/"
$ show symbol x
  X = "/today+4/today+4/"
$ write sys$output "''f$type(x)'"
STRING
 
 
  The f$cvtime lexical is not particularly relevent here, this particular
  behaviour is an artifact of DCL symbols and of DCL string handling.

answer written or last revised on ( 29-MAR-2000 )

» close window