EnvironmentVariable class

The EnvironmentVariable class and the EnvironmentVariableList class enable you to access and set iSeries™ system-level environment variables.

EnvironmentVariable class

EnvironmentVariableList class

Each variable has unique identifiers: the system name and the environment variable name. Each environment variable is associated with a CCSID, which is by default the CCSID of the current job, which describes where the contents of the variable are stored.

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

Use an EnvironmentVariable object to perform the following actions on an environment variable:

Example: Creating, setting, and getting environment variables

The following example creates two EnvironmentVariables and sets and gets their values.
Note: Read the Code example disclaimer for important legal information.
     // Create the iSeries system object.
     AS400 system = new AS400("mySystem");

     // Create the foreground color environment variable and set it to red.
     EnvironmentVariable fg = new EnvironmentVariable(system, "FOREGROUND");
     fg.setValue("RED");

     // Create the background color environment variable and get its value.
     EnvironmentVariable bg = new EnvironmentVariable(system, "BACKGROUND");
     String background = bg.getValue();