Language Reference Guide : System Classes : SessionObject Class : GetEnv Method
 
Share this page          
GetEnv Method
The GetEnv method returns the current setting of an environment variable. The environment variable name and value will be transliterated according to the coding defined by II_CHARSETxx. If II_CHARSETxx is not set to UTF8, then the local code page is used for transliteration (the value of II_CHARSETxx must match with the active code page to work correctly). On the Linux or UNIX operating system, the local code page can be changed to UTF8 by running the mwcontrol intel.cpl command, checking “Use UTF8,” and clicking OK.
It is possible to use characters in Microsoft Windows environment variables that are outside of the current codepage (for example, Win1252) by using Unicode characters and setting II_CHARSETxx to UTF8. The name of the variable can be used by escape sequence with UTF-16 encoding such as "Var€" = U&'Var\20AC' in the 4GL. This is also possible on Linux or UNIX operating systems.
For GetEnv() method, the variable name and value will be transliterated as shown in the following table:
II_CHARSETxx Value
Active Code Page
Outcome
UTF8
acp
UTF8 is used for transliteration
non UTF8
acp
acp value is used for transliteration
GetEnv() also supports wide (wchar_t) characters of name/value in environment variables on Windows Operating system.
This method has the following syntax:
nvarchar(16000) = SessionObject.GetEnv(name = nvarchar(16000))
This method has the following parameter:
name
Identifies the environment variable
If the environment variable is not set, the method returns an empty string.