getenv

Description

The getenv() function returns the value of the environment variable that is specified in the name parameter.

Values that are returned by getenv are unaffected by the setenv, keepenv, and unsetenv procedures, because getenv accesses the user’s original, read-only task environment variable information that is stored in the env variable from the client on the submit host.

Syntax

result = getenv (name, value);

Arguments

name Required. A string that contains the name of a task environment variable.
value Optional. A string that contains the value to use if the environment variable name does not exist in env.

Return Values

If the specified task environment variable is found, then result contains its value.

If the specified task environment variable is not found, then the value returns as a string. If value is not specified, then an empty string is returned.

result = getenv ("TZ");

In this example, the value of the environment variable TZ is retrieved from env and stored in result. If TZ is not found, then result is empty.

For more information, see setenv.