Unexpected job behavior if Global Variables are appended to. (NETIQKB73154)

  • 7773154
  • 22-Aug-2011
  • 22-Aug-2011

Environment

NetIQ AppManager 7.0.x
NetIQ AppManager 8.0

Situation

Global variables in Knowledge Scripts may contain data from previous Job iterations which may result in unexpected KS behavior.
Global variables in Knowledge Scripts may contain data from previous Job iterations which may result in memory issues for the job or Agent.

Resolution

To prevent this behavior, when writing or customizing a Knowledge Script, ensure that any global variable which is appended is reset to a default value at some point during its execution.

IMPORTANT: Resetting a global variable is an activity that must be performed within a function or subroutine since the code outside a function or subroutine is executed only on the first execution of a job.

Cause

Global variables in Knowledge Scripts are variables that are defined outside a function or subroutine. They are only created on the first iteration of a job, and their original values are retained across all job iterations.

If a global variable is appended to, for example by string concatenation, adding to an array, or performing a numeric calculation, this may result in unwanted behavior in a job after the first iteration because the variable will no longer have the expected value.

Additional Information

Formerly known as NETIQKB73154

This behavior differs from native VBScript.