VMS Help
Lexicals, F$UNIQUE
*Conan The Librarian
|
Valid on Alpha and Integrity server systems only.
Generates a string that is suitable to be a file name and is
guaranteed to be unique across the cluster. Unique file names can
be useful when creating temporary files. (See CLOSE/DISPOSITION
for an example.)
The F$UNIQUE function has no arguments, but must be followed by a
blank pair of parentheses.
Format
F$UNIQUE()
A character string containing the unique string.
1.$ WRITE SYS$OUTPUT F$UNIQUE()
414853555241159711D7DF797CCF573F
$
$ WRITE SYS$OUTPUT F$UNIQUE()
414853555241509811D7DF797E3F2777
$
This example shows how a unique string is returned on
subsequent WRITE commands.
2.$ OPEN/WRITE TEMP_FILE 'F$UNIQUE()
$ DIRECTORY
Directory WORK1:[TEST]
594B53554C421C9C11D75463D61F58B7.DAT;1
Total of 1 file.
$
$ CLOSE/DISPOSITION=DELETE TEMP_FILE
$ DIRECTORY
%DIRECT-W-NOFILES, no files found
$
The first command creates a temporary file and gives it a
unique name, which is displayed by the subsequent DIRECTORY
command. After the file is later closed and deleted, it no
longer shows up in the directory.