Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent for BMC Helix Operations Management 24.2.

set()


Assign a value to a variable.

Syntax

set(variable,value,[epochtime])

Parameter

Parameter

Definition

variable

name of a variable in the PATROL Agent object hierarchy to which value is assigned The variable parameter is validated using the following rules:

  • variable is composed of name segments separated by a slash check
  • variable may start with a slash check, but not end with a slash check
  • variable may not contain empty segments
  • variable may not contain unprintable characters
  • variable may not contain white space other than the space character
  • variable may contain spaces within a segment but not at the beginning or end of a segment

value

numeric or string value that is assigned to variable

epochtime

numeric value that "timestamps" the value being set This value is optional.

Description

The set() function sets the value of variable to be value. If variable is a relative name and does not exist in the context of the PSL script, the set() function successively searches each ancestor's context until variable is found or until the search fails in the context of the computer. 

The set() function always returns the NULL string. However, if the variable parameter is not valid, the PSL run-time error532, "Badly formed object name." is generated. 

The set() function can take an optional third argument, epochtime. This argument timestamps the value being set and only has meaning when setting a parameter value. For example, the following code will set the parameter value for a period one hour in the past:

 

set("/APP/Inst/param/value", "42", time() - 3600);
Warning

Variables set in the configuration database, for example using PSL pconfig("REPLACE") were once made readable at the same variable name in the regular variable namespace for convenience. Reading variables in this way is deprecated and will produce warning messages. Furthermore, variables created this way are read only, so an attempt to use set() to change the value will result in a "write permission denied" error. 

Example

The following PSL statement sets the value of RDB database Dev parameter MyParam to 10.

 

set("/RDB/Dev/MyParam/value",10);

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*