VMS Help Lexicals, F$PARSE, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1.$ SET DEF DISK2:[FIRST] $ SPEC = F$PARSE("JAMES.MAR","[ROOT]",,,"SYNTAX_ONLY") $ SHOW SYMBOL SPEC SPEC = "DISK2:[ROOT]JAMES.MAR;" In this example, the F$PARSE function returns the expanded file specification for the file JAMES.MAR. The example uses the SYNTAX_ONLY keyword to request that F$PARSE check the syntax, but should not verify that the [ROOT] directory exists on DISK2. The default device and directory are DISK2:[FIRST]. Because the directory name [ROOT] is specified as the default-spec argument in the assignment statement, it is used as the directory name in the output string. Note that the default device returned in the output string is DISK2, and the default version number for the file is null. You must place quotation marks (" ") around the arguments JAMES.MAR and ROOT because they are string literals. If you had not specified syntax-only parsing, and [ROOT] were not on DISK2, a null string would have been returned. 2.$ SET DEFAULT DB1:[VARGO] $ SPEC = F$PARSE("INFO.COM",,,"DIRECTORY") $ SHOW SYMBOL SPEC SPEC = "[VARGO]" In this example the F$PARSE function returns the directory name of the file INFO.COM. Note that because the default-spec and related-spec arguments are omitted from the argument list, commas (,) must be inserted in their place. 3.$ SPEC= F$PARSE("DENVER::DB1:[PROD]RUN.DAT",,,"TYPE") $ SHOW SYMBOL SPEC SPEC = ".DAT" In this example, the F$PARSE function is used to parse a file specification containing a node name. The F$PARSE function returns the file type .DAT for the file RUN.DAT at the remote node DENVER.
|