Run-Time Function: Sets the value of an existing environment variable, or adds and sets a new environment variable.
Module: USE DFLIB
Syntax
Results:
The result is of type LOGICAL(4). The result is .TRUE. if successful; otherwise, .FALSE..
Environment variables define the environment in which a program executes. For example, the LIB environment variable defines the default search path for libraries to be linked with a program.
SETENVQQ deletes any terminating blanks
in the string. Although the equal sign (=) is an illegal character within
an environment value, you can use it to terminate value so that
trailing blanks are preserved. For example, the string
PATH= =
sets value to ''
.
You can use SETENVQQ to remove an existing variable by giving a variable name followed by an equal sign with no value. For example, LIB= removes the variable LIB from the list of environment variables. If you specify a value for a variable that already exists, its value is changed. If the variable does not exist, it is created.
SETENVQQ affects only the environment that is local to the current process. You cannot use it to modify the command-level environment. When the current process terminates, the environment reverts to the level of the parent process. In most cases, this is the operating system level. However, you can pass the environment modified by SETENVQQ to any child process created by RUNQQ. These child processes get new variables and/or values added by SETENVQQ.
SETENVQQ uses the C runtime routine _putenv and GETENVQQ uses the C runtime routine getenv. From the C documentation:
SETENVQQ and GETENVQQ will not work properly with the Win32 APIs SetEnvironmentVariable and GetEnvironmentVariable.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: GETENVQQ
Example
USE DFLIB
LOGICAL(4) success
success = SETENVQQ("PATH=c:\mydir\tmp")
success = &
SETENVQQ("LIB=c:\mylib\bessel.lib;c:\math\difq.lib")
END