Sets your default device and directory specifications. The new default is applied to all subsequent file specifications that do not explicitly include a device or directory name. When you change the default device assignment, the system equates the specified device with the logical name SYS$DISK. Format SET DEFAULT [device-name[:]][directory-spec]
1 – Parameters
device-name[:] Specifies the name of the device you want to go to. NOTE The SET DEFAULT command will accept a node name with the device name (that is, node-name::device-name). However, the results of operations using a default with a node name are unpredictable. Some utilities and applications do not allow a node name to be specified in a file specification and will fail if the default file specification contains a node name. directory-spec Specifies the name of the directory you want to go to. A directory name must be enclosed in brackets ([ ]). Use the minus sign (-) to specify the next higher directory from the current default. On Alpha systems, if the length of the resulting default directory specification exceeds 255 characters, the SET DEFAULT attempts to replace the default directory string with a generated directory specification. If this happens, then in addition to the normal syntax check, the entire path to that specification, including the device, is verified and must exist for the call to succeed. On Alpha systems, if the process parse style is set to extended, then the directory specification may include a directory ID (DID). You must specify either the device-name parameter or the directory-spec parameter. If you specify only the device name, the current directory is the default for the directory-spec parameter. If you specify only the directory name, the current device is the default for the device-name parameter. You can use a logical name but it must constitute at least the device part of the specification. When you use a search list logical name as the parameter, the logical name is not translated by the SET DEFAULT command. Instead, the SET DEFAULT command retains the logical name so that OpenVMS Record Management Services (RMS) is able to access the entire search list. If you enter the SHOW DEFAULT command, the search list logical name is displayed as the default device, along with its equivalence strings.
2 – Examples
1.$ SET DEFAULT [TANNER] The SET DEFAULT command in this example changes the default directory to [TANNER]. The default disk device does not change. 2.$ SET DEFAULT $FLOPPY1:[MOREAU.MEMOS] The SET DEFAULT command in this example sets your default to the MOREAU.MEMOS subdirectory on $FLOPPY1. 3.$ SET DEFAULT $FLOPPY1: The SET DEFAULT command in this example sets the default device to $FLOPPY1. The directory name does not change. 4.$ SET DEFAULT [-] The SET DEFAULT command in this example changes the default directory to the parent directory of the one you are currently in. For example, if the current directory is $FLOPPY1:[NIELSEN.MEMOS], this command sets your default to $FLOPPY1:[NIELSEN]. If you are in $FLOPPY1:[NIELSEN], this command sets your default to the master directory on the disk- $FLOPPY1:[000000]. 5.$ SAVEDEF = F$ENVIRONMENT("DEFAULT") $ SET DEFAULT [122001.ZAMORA.APP10] . . . $ SET DEFAULT 'SAVEDEF' The command procedure in this example uses the F$ENVIRONMENT lexical function to save the current default directory in the symbol named SAVEDEF. The SET DEFAULT command changes the default directory 122001.ZAMORA.APP10. Later, the symbol SAVEDEF is used to restore the original default directory. 6.$ SHOW DEFAULT WORK:[TOP] $ DEFINE X WORK:[TOP.SUB1],WORK:[TOP.SUB2] $ SET DEFAULT X $ SHOW DEFAULT X:[TOP] $ DIRECTORY Directory WORK:[TOP.SUB1] KUDOS.TMP;1 Total of 1 file. Directory WORK:[TOP.SUB2] KUDOS.TMP;1 Total of 1 file. Grand total of 2 directories, 2 files. $ DIRECTORY [] Directory WORK:[TOP] KUDOS.TMP;1 NETSERVER.LOG;2 Total of 2 files. In this example, the default directory is WORK:[TOP]. X is then defined to be a search list consisting of two subdirectories. When the SET DEFAULT X command is entered, the search list (X) is equated with the logical name SYS$DISK and is entered into the disk field. The subsequent SHOW DEFAULT command shows both the search list and the current default directory, followed by the expanded search list. If a DIRECTORY command is entered, the directories searched are those contained in the logical name X; however, if the current default directory specification ([]) is explicitly entered, the current default directory, rather than SYS$DISK, is searched. 7.$SET PROCESS/PARSE_STYLE=EXTENDED $SET DEFAULT WORK:[11,1,0] $SHOW DEFAULT WORK:[11,1,0] $DIRECTORY Directory WORK:[11,1,0] X.X;1 Total of 1 file. On Alpha systems, the SET DEFAULT command in this example uses a directory ID (DID) in the directory specification. 8.$SET PROCESS/PARSE_STYLE=EXTENDED $SET DEFAULT - WORK:[.LONG_DIRECTORY_NAME_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA] $SET DEFAULT - WORK:[.LONG_SUBDIRECTORY_NAME_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB] $SET DEFAULT - WORK:[.LONG_SUBDIRECTORY_NAME_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC] $SET DEFAULT - WORK:[.LONG_SUBDIRECTORY_NAME_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD] $SET DEFAULT - WORK:[.LONG_SUBDIRECTORY_NAME_EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE] $SHOW DEFAULT MDA0:[15,1,0] $SET DEFAULT [-] %RMS-F-DIR, error in directory name $SET DEFAULT [.TEST] $SHOW DEFAULT MDA0:[15,1,0.TEST] On Alpha systems, because the total length of the default directory string would exceed 255 characters in this example, a Directory ID is used in the directory specification. When the default directory string is replaced with a Directory ID, it is not possible to use the minus sign to specify the next higher directory.