Universal Data Mover Variables
Introduction
Variables are integral data storage objects in the Universal Scripting Engine.
Variable Types
There are two types of variables:
- Script
- Global (user-defined and built-in)
Variable Names
There are no restrictions on variable names except:
- They cannot contain double-quote marks ( " ) or spaces.
- UDM reserves variable names beginning with an underscore ( _ ) for its own internal (built-in) variables (see UDM - Built-In Variables). You cannot create a script variable or user-defined global variable that begins with an underscore ( _ ).
Variable Reference
To obtain the value of a variable, you must create a reference for that variable. The reference can appear anywhere in a script line. It is replaced with the value of the referenced variable.
Referencing the value of a global variable in a script is done exactly the same way as for a script variable:
$(variable_name)
For example:
Variable Attributes
In addition to accessing the value of a variable, you can access information about that variable through its attributes.
variable attribute is referenced by putting a dot ( . ) after the variable name in a variable reference. For example:
$(name.attribute)
There are two variable attributes that can be used for any variable:
exists
length
Note
Some built-in variables have attributes specific to those variables.
exists Attribute
The exists attribute expands to yes if a variable with that name exists at any scope; it expands to no if no variable with that name exists.
Note
Unlike when referencing a variable's value, an error is not issued if the exists attribute is used for a variable name that does not exist.
A Stonebranch Tip
You can use the exists attribute in combination with the if statement to determine if a variable exists (and take the appropriate action if it does):
if $(filename.exists) EQ yes
copy src=$(filename)
end
length Attribute
The length attribute expands to the length of the variable's value. If the length attribute is used for a variable that does not exist, an error is issued.
A Stonebranch Tip
You can use the length attribute in combination with the if statement to decide if a file name is too long to copy to a remote system:
if $(filename.length) LE 8
copy src=$(filename)
end