symbol-name
Specifies a string of 1 to 255 characters for the symbol name. The name
can contain any alphanumeric characters from the DEC Multinational
character set, the underscore (_), and the dollar sign ($). However,
the name must begin only with an alphabetic character, an
underscore, or a dollar sign. Using one equal sign (:=) places the
symbol name in the local symbol table for the current command level.
Using two equal signs (:==) places the symbol name in the global symbol
table.
string
Names the character string value to be equated to the symbol. The
string can contain any alphanumeric or special characters. DCL uses a
buffer that is 1024 bytes long to hold a string assignment statement.
Therefore, the length of the symbol name, the string, and any symbol
substitution within the string cannot exceed 1024 characters.
With the string assignment statement (:=), you do not need to enclose a
string literal in quotation marks (" "). String values are
converted to uppercase automatically. Also, any leading and trailing
spaces and tabs are removed, and multiple spaces and tabs between
characters are compressed to a single space.
To prohibit uppercase conversion and to retain required space and tab
characters in a string, place quotation marks around the string. To use
quotation marks in a string, enclose the entire string within quotation
marks and use a double set of quotation marks within the string. For
example:
$ TEST := "this is a ""test"" string"
$ SHOW SYMBOL TEST
TEST = "this is a "test" string"
|
In this example, the spaces, lowercase letters, and quotation marks are
preserved in the symbol definition.
To continue a symbol assignment on more than one line, use the hyphen
(-) as a continuation character. For example:
$ LONG_STRING := THIS_SYMBOL_ASSIGNMENT_IS_A_VERY_LONG-
_$ _SYMBOL_STRING
|
To assign a null string to a symbol by using the string assignment
statement, do not specify a string. For example:
Specify the string as a string literal, or as a symbol or lexical
function that evaluates to a string literal. If you use symbols or
lexical functions, place single quotation marks (` ') around them to
request symbol substitution. See the OpenVMS User's Manual for more information
on symbol substitution.
You can also use the string assignment statement to define a foreign
command. See the OpenVMS User's Manual for more information about foreign
commands.
[offset,size]
Specifies that a portion of a symbol value is to be overlaid with a
replacement string. This form of the string assignment statement
evaluates the value assigned to a symbol and then replaces the portion
of the value (defined by the offset and size) with the replacement
string. The brackets are required notation, and no spaces are allowed
between the symbol name and the left bracket.
The offset specifies the character position relative to the beginning
of the symbol name's string value at which replacement is to begin.
Offset values start at 0.
If the offset is greater than the offset of the last character in the
string you are modifying, spaces are inserted between the end of the
string and the offset where the replacement string is added. The
maximum offset value you can specify is 768.
The size specifies the number of characters to replace. Size values
start at 1.
Specify the offset and size as integer expressions. See the
OpenVMS User's Manual for more information on integer expressions. The value of
the size plus the offset must not exceed 769.
replacement-string
Specifies the string that is used to overwrite the string you are
modifying. If the replacement string is shorter than the size argument,
the replacement string is filled with blanks on the right until it
equals the specified size. Then the replacement string overwrites the
string assigned to the symbol name. If the replacement string is longer
than the size argument, then the replacement string is truncated on the
right to the specified size.
You can specify the replacement string as a string literal, or as a
symbol or lexical function that evaluates to a string literal. If you
use symbols or lexical functions, place single quotation marks (` ')
around them to request symbol substitution. For more information on
symbol substitution, see the OpenVMS User's Manual.
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.
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.