Difference between revisions of "F$DIRECTORY()"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "'''F$DIRECTORY''' is a lexical function that returns the current default directory name string. The F$DIRECTORY function has no arguments, but must be fo...")
 
m (removed extra spaces)
 
Line 18: Line 18:
 
  $ SET DEFAULT 'SAVE_DIR'
 
  $ SET DEFAULT 'SAVE_DIR'
  
This example shows an excerpt from a command procedure that  uses the F$DIRECTORY function to save the current default directory setting. The assignment statement equates the symbol SAVE_DIR to the current directory. Then the SET DEFAULT command establishes a new default directory. Later, the symbol SAVE_DIR is used in the SET DEFAULT command that restores the original default directory.
+
This example shows an excerpt from a command procedure that  uses the F$DIRECTORY function to save the current default directory setting. The assignment statement equates the symbol SAVE_DIR to the current directory. Then the SET DEFAULT command establishes a new default directory. Later, the symbol SAVE_DIR is used in the SET DEFAULT command that restores the original default directory.
  
Note that you can use the [[F$ENVIRONMENT()]] function with the  DEFAULT keyword to return the default disk and directory. You should use the F$ENVIRONMENT function rather than the F$DIRECTORY function in situations involving more than one disk.
+
Note that you can use the [[F$ENVIRONMENT()]] function with the  DEFAULT keyword to return the default disk and directory. You should use the F$ENVIRONMENT function rather than the F$DIRECTORY function in situations involving more than one disk.
  
 
[[Category:Lexical Functions]]
 
[[Category:Lexical Functions]]

Latest revision as of 10:13, 29 June 2019

F$DIRECTORY is a lexical function that returns the current default directory name string. The F$DIRECTORY function has no arguments, but must be followed by parentheses.

Syntax

F$DIRECTORY()

Return_Value

A character string for the current default directory name, including brackets ([]). If you use the SET DEFAULT command and specify angle brackets (<>) in a directory specification, the F$DIRECTORY function returns angle brackets in the directory string.

Examples

$ SAVE_DIR = F$DIRECTORY()
$ SET DEFAULT [CARLEN.TESTFILES]
.
.
.
$ SET DEFAULT 'SAVE_DIR'

This example shows an excerpt from a command procedure that uses the F$DIRECTORY function to save the current default directory setting. The assignment statement equates the symbol SAVE_DIR to the current directory. Then the SET DEFAULT command establishes a new default directory. Later, the symbol SAVE_DIR is used in the SET DEFAULT command that restores the original default directory.

Note that you can use the F$ENVIRONMENT() function with the DEFAULT keyword to return the default disk and directory. You should use the F$ENVIRONMENT function rather than the F$DIRECTORY function in situations involving more than one disk.