GlobalVarSet Function

Action

Sets the value of a global integer variable. Global variables are accessible for all users running on all agents.

Include file

Kernel.bdh

Syntax

GlobalVarSet( in sVariable : string,
              in nValue    : number,
              in nTimeout  : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sVariable Name of the global variable whose value is to be set.
nValue Value that is assigned to the global variable.
nTimeout Optional: Timeout for setting the value in seconds. If the specified time period is exceeded, Silk Performer indicates an error.

The function’s default behavior is to wait until the set operation is done.

Example

dcltrans
  transaction TInit
  begin
    if GetUserID() = 1 then
      GlobalVarSet("global counter", 1000);
    end;
    GlobalWaitFor("All", ALL_USERS);
  end TInit;