:SET
Script Statement: Stores a value in a script variable.
Syntax
:S[ET] Script variable = Value
Syntax |
Description/Format |
---|---|
Script variable |
The name of the script variable to which a value should be assigned. You must always use an ampersand symbol (&) that precedes the script variable's name, and it is recommended that you use a hash (#) symbol to signal the end of the variable's name. The length of a script variable's name is limited to 32 characters. All characters of the alphabet, the numbers 0-9, and the following special characters can be used:"$", "_", "@", "ยง" and "#". German Umlauts are not allowed. The first character after the leading "&", which is not part of the 32-character limit, must neither be a number nor a "$" symbol. For more details about the syntax, see Syntax Format: script variable |
Value |
The value that should be assigned to the script variable. Format: script literal, script variable or script function |
Comments
Refer to the topic that describes the peculiarities and practical usage of script variables.
If a specified script variable does not exist, it will be created without a specific data type.
You can also use :SET to solve arithmetic expressions. For more information, see Calculations.
When predefined variables that are enclosed in parentheses are used as values and supply numerical values (such as &$CLIENT#), they will automatically be converted to the 16-digit default format.
Notes:
- You can use the same script variable name in :SET and :RSET but assign different values to each script variable. :SET and :RSET will set the assigned values when the corresponding job is executed. This procedure is different when you restart the corresponding job. In this case, the values of both script variables are set by the :SET. This happens because :RSET automatically creates object values, and :SET automatically stores values for restarts.
- The length of :SET itself is not limited but when you set a script variable that includes more than 1024 characters, it will be truncated at this length when you add it as a comment with the script statement :ADD_COMMENT
Examples
The following example assigns a file name to the script variable called"&FILE".
:SET &FILE# = "L.LST.FILE"
The next example retrieves the current date by using the script function SYS_DATE and assigns it to the script variable called "&TODAY".
:SET &TODAY# = SYS_DATE(YYMMDD)
A script variable can also include numbers:
:SET &NUMBER# = 1
You can also assign a script variable's value to a different script variable:
:SET &NR# = &NUMBER#
See also:
Script element | Description |
---|---|
:DEFINE | Declares a script variable with a particular data type. You can also use it to redefine variables that have already been defined by :SET. |
Assigns a value to an object variable. |
|
Assigns a value to a script variable and saves it to the activation report. |
|
Sets the values of script variables by indirect access. |
Script Elements - Script Structure and Processing
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by function