Best Practices Guide > Assigning and Using Values

Assigning and Using Values

Guideline for using values

Various values are used in objects. They serve to specify the host on which jobs run, the files which should be processed, the type of reaction to events etc. An advantage of AE's object orientation is that these values can be dynamically set and processing can be controlled by the particular situation.

AE provides several ways of storing values and assigning them to other objects.

Variable Objects

Values that are relevant for many tasks are stored in static Variable objects. A client's objects can access their contents and modify them using script elements.

The following illustration shows a static Variable object. It already contains the variable "HOST" with value "unix01".

Example:

The responsible administrator is entered in the Variable object using the script statement :PUT_VAR. The host name is changed to "unix02".

:PUT_VAR "DB_MAINTENANCE", "ADMIN", "Smith"
:
PUT_VAR "DB_MAINTENANCE", "HOST", "unix02"

A task reads the host name using the script function GET_VAR:.

:SET &HOST# = GET_VAR("DB_MAINTENANCE", "HOST")

The script statement :DELETE_VAR deletes the host specification from the Variable object:

:DELETE_VAR "DB_MAINTENANCE", "HOST"

Object Variables

Values that are only relevant for individual tasks are stored directly in the object. Almost all executable objects contain a Values tab which can be used to enter variables that should be used in the Process tabs. These values can be used directly as script variables.

The following screenshot shows the object variable "&HOST#".

This variable can be immediately used in the script. The following example uses the object variable to terminate the agent.

:TERMINATE ,&HOST#

There is a peculiarity which applies to object variables. They can be inherited from the superordinate object. For example, tasks of a Schedule can use the object variables of its Schedule. This simplifies maintenance because it is no longer necessary to store the values in all individual objects.

Input Buffer

Values relevant for a task that is started using ACTIVATE_UC_OBJECT can be stored in an input buffer. This is done using the script statement :PUT_READ_BUFFER . The task reads the stored values with the script statement :READ.

Example:

A job puts the name of its agent to the input buffer and then calls a notification:

:SET &att_host# = GET_ATT(HOST)
:
PUT_READ_BUFFER host# = '&att_host#'

:SET &ret# = ACTIVATE_UC_OBJECT('CALLOP')

Notifications can read agent names:

:READ &host#,,

:PRINT "Agent: &host#"