CL Command Reference - ADDENVVAR

CL Command List > ADDENVVAR Reference

Description:

The Add Environment Variable (ADDENVVAR) command adds an environment variable consisting of a character string in the form ¡¯environment variable name=environment variable value¡¯. Environment variables can be used, for example, to specify configuration values to application programs on systems that are compliant with the Single UNIX Specification.

If you are not ready to set the environment variable value, you can use this command to add an environment variable with a null value. You can then use the Add Environment Variable (ADDENVVAR) or Change Environment Variable (CHGENVVAR) command to associate the environment value with the environment variable name.

Restriction: You must have *JOBCTL special authority to use this command to add system-level environment variables.


Examples:

Example 1: Add an Environment Variable with CCSID 37

ADDENVVAR ENVVAR(altdir) VALUE(¡¯/mydir/dir2¡¯) CCSID(37)

This command adds the environment variable named altdir with the value /mydir/dir2 to the environment variables for the job. The value 37 is stored with the environment variable to indicate its CCSID.



Example 2: Set an Environment Variable to Null

ADDENVVAR ENVVAR(LIBPATH) VALUE(*NULL)

This command adds the environment variable named LIBPATH with the null (x¡¯00) character value to the environment variables for the job.



Example 3: Add a System-level Environment Variable

ADDENVVAR ENVVAR(homedir) VALUE(¡¯/home¡¯) LEVEL(*SYS)

This command adds a system-level environment variable named homedir with value /home.



Example 4: Reset a Job-level Environment Variable

ADDENVVAR ENVVAR(altdir) VALUE(¡¯/mydir/dir3¡¯) REPLACE(*YES)

This command replaces the existing value of the variable altdir with the new value of /mydir/dir3.