GetEnv function

Syntax

GetEnv(env_var)

Description

Use the GetEnv function to return the value of an environment variable specified by env_var as a string. If the environment variable does not exist, GetEnv it returns a null string.

For example, you can use the GetEnv function to determine the actual path of PS_HOME. You could use this with the Exec function, which automatically prefixes the command string with the path of PS_HOME.

Parameters

Parameter Description

env_var

A string specifying the environment variable.

Important: Because the input string is converted to all uppercase, the env_var parameter is case-insensitive. While environment variable names are case-sensitive on UNIX systems—that is, "netdrive" is a different variable from "NetDrive"—in both cases, GetEnv returns the value of the NETDRIVE environment variable if it exists.

Returns

A string representing the value of the specified environment variable; Null if the variable does not exist.

Example

Assume that the environment variable NETDRIVE is equal to "N:" and the environment variable netdrive is equal to "P:”. The following statement returns "N:" in &drive:

&drive = GetEnv("netdrive");

Furthermore, if the environment variables netdrive and NetDrive are defined on a UNIX system, but not NETDRIVE, each of the following calls to GetEnv return Null:

&string = GetEnv("netdrive");
&string = GetEnv("NetDrive");
&string = GetEnv("NETDRIVE");