Default directory

From VSI OpenVMS Wiki
Jump to: navigation, search

A default directory is the working directory of the user, the directory that the system uses in file specifications when no directory is specified. When a user logs in, their default directory is the directory specified in the user's SYSUAF record.

Example

Consider the following command:

$ TYPE REPORT.LIS;257

The directory specification for REPORT.LIS;257 is omitted. The system will look for the file in the current default directory:

$ SHOW DEFAULT
  DKA0:[00000]

If the file is not found in that directory, a RMS-E-FNF error will be displayed:

%TYPE-W-SEARCHFAIL, error searching for DKA0:[000000]REPORT.LIS;257
-RMS-E-FNF, file not found

Managing the default directory

To display your current default directory, use the SHOW DEFAULT command. To set a different default directory, use the SET DEFAULT command. Note that any directory can be set as default, including nonexistent directories and directories which your process may not access; no error message will be displayed by SET DEFAULT.

Default device and default directory

If only the directory is specified with the SET DEFAULT command, the former device will be used. Sometimes this leads to unexpected errors, especially if rooted logicals are used:

$ show def
  SYS$SYSROOT:[SYSMGR]
  =   SYS$SYSROOT:[SYSMGR]
  =   SYS$COMMON:[SYSMGR]
$ set def dka0:
$ show def
  DKA0:[SYSMGR]
%DCL-I-INVDEF, DKA0:[SYSMGR] does not exist
 

To avoid this, use the complete directory specification with the SET DEFAULT command. If you need to access the master file directory on a volume, specify [000000].