Use the context keyword service to access environment information for the current context. In the default environment, this service returns host workstation environment variables. When running within EAServer, you can use the keyword service to get a specific component property value (on all EAServer platforms except AIX, you must use Keyword as the string parameter in the GetContextService function).
For information about using the context keyword service in EAServer, see “Accessing component properties”.
When running in the PowerBuilder execution environment (the default context), you use this service to return environment variables.
To access environment variables:
Declare an instance or global variable of type ContextKeyword. Also declare an unbounded array of type String to contain returned values:
ContextKeyword icxk_base
String is_values[]
Create the context information service by calling the GetContextService function:
this.GetContextService("Keyword", icxk_base)
Call the GetContextKeywords function to access the environment variable you want. This example calls the GetContextKeywords function to determine the current application Path:
icxk_base.GetContextKeywords("Path", is_values)
Extract values from the returned array as necessary. When accessing environment variables, the array should always have a single element:
MessageBox("Path", "Path is: " + is_values[1])