Remove Environment Variable (RMVENVVAR)

Where allowed to run: All environments (*ALL)
Threadsafe: Yes
Parameters
Examples
Error messages

The Remove Environment Variable (RMVENVVAR) command removes an environment variable (or all environment variables) that exists.

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

Top

Parameters

Keyword Description Choices Notes
ENVVAR Environment variable Character value, *ALL Required, Positional 1
LEVEL Level *JOB, *SYS Optional
Top

Environment variable (ENVVAR)

Specifies the name of the environment variable to be removed. If an environment variable by this name does not exist at the specified level (LEVEL parameter), error message CPFA981 is issued.

If the special value of *ALL is specified, then all environment variables at the specified level (LEVEL parameter) are removed.

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

Level (LEVEL)

Specifies the level of the environment variable.

The possible values are:

*JOB
This is a job-level environment variable.
*SYS
This is a system-level environment variable.
Top

Examples

Example 1: Remove a Job-level Environment Variable

RMVENVVAR   ENVVAR(altdir)

This command removes the job-level environment variable named altdir.

Example 2: Remove a System-level Environment Variable

RMVENVVAR   ENVVAR(home)  TYPE(*SYS)

This command removes the system-level environment variable named home.

Example 3: Remove All Job-level Environment Variables

RMVENVVAR   ENVVAR(*ALL)

This commands removes all job-level environment variables.

Example 4: Remove All System-level Environment Variables

RMVENVVAR   ENVVAR(*ALL)  LEVEL(*SYS)

This commands removes all system-level environment variables.

Top

Error messages

*ESCAPE Messages

CPFA981
Environment variable does not exist.
CPFA98E
*JOBCTL special authority required to update system-level environment variables.
Top