Variables

A variable is a location in memory where a value can be stored. It is a named entity that refers to data to which you can assign values. The data type and value of a variable can be different at different times and can have a primitive or compound data type as its value. HPE Service Manager contains three types of variables:

  • Local
  • Global
  • Thread

Local variables begin with $L. and persist only within the currently executing RAD application. The server automatically cleans up local variables when it exits a RAD application.

Global variables begin with $G. or $lo. and persist throughout a user session ($lo. is an abbreviation for logged on. These variables are set when the operator logs on). The server automatically cleans up global variables when a user logs off the system.

Thread variables do not have a consistent naming scheme other than beginning with a dollar sign ($). Thread variables are only valid for the current RAD thread. If the RAD thread terminates, then the server automatically cleans up all thread variables.

Creating variables

The rules for creating variables are as follows:

  • A variable name must begin with a dollar sign ($) and an alphabetic character followed by zero or more alphanumeric characters that may include periods, but may not include blanks.
  • A variable name can be any length.
  • A variable's value is initialized to a null string.
  • Data assigned to a variable has a data type. This data type becomes the variable's data type.
  • Any variable can be set to a null value by assigning the value NULL to it. For example, $variable=NULL.
  • Global variables are treated as global among all applications executed within the process or task with two exceptions:

    • When the variable is designated local (or something other than global) by an initial identifier. For example, when the variable is created within a function.
    • When the variable is a parameter variable.