VMS Help Lexicals, F$TYPE, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
1.$ NUM = "52" $ TYPE = F$TYPE(NUM) $ SHOW SYMBOL TYPE TYPE = "INTEGER" This example uses the F$TYPE function to determine the data type of the symbol NUM. NUM is equated to the character string "52". Because the characters in the string form a valid integer, the F$TYPE function returns the string INTEGER. 2.$ NUM = 52 $ TYPE = F$TYPE(NUM) $ SHOW SYMBOL TYPE TYPE = "INTEGER" In this example, the symbol NUM is equated to the integer 52. The F$TYPE function shows that the symbol has an integer data type. 3.$ CHAR = "FIVE" $ TYPE = F$TYPE(CHAR) $ SHOW SYMBOL TYPE TYPE = "STRING" In this example, the symbol CHAR is equated to the character string FIVE. Because the characters in this string do not form a valid integer, the F$TYPE function shows that the symbol has a string value. 4.$ x = F$CONTEXT("PROCESS",CTX,"USERNAME","SMITH") $ TYPE = F$TYPE(CTX) $ SHOW SYMBOL TYPE TYPE = "PROCESS_CONTEXT" $ x = F$CONTEXT("PROCESS",CTX,"CANCEL") $ TYPE = F$TYPE(CTX) $ SHOW SYMBOL TYPE TYPE = "" In this example, the F$TYPE function returns the string PROCESS_CONTEXT because the symbol has been produced by a call to the F$CONTEXT function with a context type of PROCESS. The symbol returns this type until F$CONTEXT is called with the symbol and the selection-item argument value CANCEL.
|