Class EnvironmentVariable

  • All Implemented Interfaces:

    public class EnvironmentVariable
    extends Object
    implements Serializable
    Represents an IBM i system-level environment variable. An environment variable is uniquely identified by the system and the environment variable name. Environment variable names are case sensitive and cannot contain spaces or equals signs (=).

    This class can only access system-level environment variables. You must have *JOBCTL special authority to add, change, or delete system-level environment variables.

    Every environment variable has a CCSID associated with it which describes the CCSID in which its contents are stored. The default CCSID is that of the current job.

    Note that environment variables are different than system values, although they are often used for the same purpose. See SystemValue for more information on how to access system values.

    The environment variable value and CCSID are cached after being read once. Call refreshValue() to force the value and CCSID to be refreshed.

    The following example creates two EnvironmentVariables and sets and gets their values.

        AS400 system = new AS400("mysystem");
        EnvironmentVariable fg = new EnvironmentVariable(system, "FOREGROUND");
        EnvironmentVariable bg = new EnvironmentVariable(system, "BACKGROUND");
        String background = bg.getValue();
    See Also:
    EnvironmentVariableList, Serialized Form