Where allowed to run: All environments (*ALL) Threadsafe: Yes |
Parameters Examples Error messages |
The Change Environment Variable (CHGENVVAR) command changes the value for an existing environment variable.
Restriction: You must have *JOBCTL special authority to use this command to change system-level environment variables.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
ENVVAR | Environment variable | Character value | Required, Positional 1 |
VALUE | New value | Character value, *SAME, *NULL | Optional, Positional 2 |
CCSID | Coded character set ID | 1-65535, *JOB, *HEX, *SAME | Optional, Positional 3 |
LEVEL | Level | *JOB, *SYS | Optional |
Top |
Specifies the name of the environment variable to be changed. If an environment variable by this name does not exist at the specified level (LEVEL parameter), error message CPFA981 is issued.
Note: The case is preserved when lowercase characters are specified.
If an apostrophe is intended, two apostrophes must be used ('').
This is a required parameter.
Top |
Specifies the environment variable value.
The possible values are:
Note: The case is preserved when lowercase characters are specified.
Top |
Specifies the coded character set identifier (CCSID) of the text supplied on the ENVVAR and the VALUE parameters. This value is stored with the environment variable.
The possible values are:
Top |
Specifies the level of the environment variable.
The possible values are:
Note: This field is only used to specify the level of the environment variable that is being changed, and cannot be used to change the level of the environment variable.
Top |
Example 1: Change a Job-level Environment Variable
CHGENVVAR ENVVAR(altdir) VALUE('/mydir/test')
This command changes the value of the job-level environment variable named altdir to the value /mydir/test. The CCSID that is stored with the environment variable is not changed.
Example 2: Change the CCSID of an Environment Variable
CHGENVVAR ENVVAR(altdir) CCSID(273)
This command changes the CCSID of the job-level environment variable named altdir to 273. The environment variable value is not changed.
Example 3: Set an Environment Variable to Null
CHGENVVAR ENVVAR(LIBPATH) VALUE(*NULL)
This command changes the value of the job-level environment variable named LIBPATH to the null (x'00') character.
Example 4: Change a System-level Environment Variable
CHGENVVAR ENVVAR(home) VALUE('/usr/home') LEVEL(*SYS)
This command changes the value of the system-level environment variable named home to /usr/home.
Top |
*ESCAPE Messages
Top |