VMS Help
:=, Examples

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    1.$ TIME := SHOW TIME
      $ TIME
      24-DEC-2001 11:55:44

      In this example, the symbol TIME is equated to the command
      string SHOW TIME. Because the symbol name appears as the first
      word in a command string, the command interpreter automatically
      substitutes it with its string value and executes the command
      SHOW TIME.

    2.$ STAT := $DKA1:[TEDESCO]STAT
      $ STAT

      This example shows how to define STAT as a foreign command. The
      symbol STAT is equated to a string that begins with a dollar
      sign followed by a file specification. The command interpreter
      assumes that the file specification is that of an executable
      image, that is, a file with a file type of .EXE.

      When you subsequently enter STAT, the command interpreter
      executes the image.

    3.$ A = "this is a big     space."
      $ SHOW SYMBOL A
        A = "this is a big     space."
      $ B := 'A'
      $ SHOW SYMBOL B
        B = "THIS IS A BIG SPACE."

      This example compares the assignment and the string assignment
      statements. The symbol A is defined using the assignment
      statement, so lowercase letters and multiple spaces are
      retained. The symbol B is defined using the string assignment
      statement. Note that the single quotation marks (` ')  are
      required; otherwise, the symbol name B would have been equated
      to the literal string A. However, when symbol A's value is
      assigned to symbol B, the letters are converted to uppercase
      and multiple spaces are compressed.

    4.$ FILE_NAME := MYFILE
      $ FILE_NAME[0,2]:= OL
      $ SHOW SYMBOL FILE_NAME
        FILE_NAME = "OLFILE"

      In this example, the substring expression in the assignment
      statement overlays the first 2 characters of the string
      assigned to the symbol FILE_NAME with the letters OL. The
      offset of 0 requests that the overlay begin with the first
      character in the string, and the size specification of 2
      indicates the number of characters to overlay.

    5.$ FILE_NAME := MYFILE
      $ FILE_TYPE := .TST
      $ FILE_NAME[F$LENGTH(FILE_NAME),4] := 'FILE_TYPE'
      $ SHOW SYMBOL FILE_NAME
        FILE_NAME = "MYFILE.TST"

      In this example, the symbol name FILE_NAME is equated to the
      string MYFILE and the symbol name FILE_TYPE is equated to the
      string .TST. The third assignment statement uses the lexical
      function F$LENGTH to define the offset value where the overlay
      is to begin. The symbol name FILE_TYPE is used to refer to
      the replacement string (.TST). Note that you must use single
      quotation marks (` ')  to request symbol substitution.

      The F$LENGTH lexical function returns the length of the string
      equated to the symbol FILE_NAME; this length is used as the
      offset. The expression requests that 4 characters of the string
      currently equated to the symbol FILE_TYPE be placed at the end
      of the string currently equated to FILE_NAME. The resultant
      value of the symbol FILE_NAME is MYFILE.TST.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.