VMS Help  —  Lexicals  F$TYPE
    Returns the data type of a symbol. The string INTEGER is returned
    if the symbol is equated to an integer, or if the symbol is
    equated to a string whose characters form a valid integer.

    The string STRING is returned if the symbol is equated to a
    character string whose characters do not form a valid integer.

    If the symbol is undefined, a null string ("")  is returned.

    Format

      F$TYPE(symbol-name)

1  –  Return Value

    The string INTEGER is returned if the symbol is equated to an
    integer, or if the symbol is equated to a string whose characters
    form a valid integer.

    If the symbol has been produced by a call to the F$CONTEXT
    function with a context type of PROCESS or by a call to the
    F$PID function, the string returned is PROCESS_CONTEXT. A symbol
    retains this type until F$CONTEXT is called with the symbol and
    the CANCEL keyword, or until a null string ("")  is returned by a
    call to F$PID.

    Similarly, the return value is the string CLUSTER_SYSTEM_CONTEXT
    for symbols created by the F$CSID function.

    If the symbol is a context symbol, then the return value will be
    one of the types shown in the following table.

    Symbol Type          Lexical Creating Symbol

    PROCESS_CONTEXT      F$PID or F$CONTEXT (with PROCESS context
                         type)

    CLUSTER_SYSTEM_      F$CSID
    CONTEXT

    The string STRING is returned if the symbol is equated to a
    character string whose characters do not form a valid integer
    or whose type is not a context.

    If the symbol is undefined, a null string is returned.

2  –  Argument

 symbol-name

    Specifies the name of the symbol to be evaluated.

3  –  Examples

    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.
Close Help