Product Site

1.13.6. Environment Symbols

An environment symbol starts with a period and has at least one other character. The symbol may not be a valid Rexx number. By default the value of an environment symbol is the string consisting of the characters of the symbol (translated to uppercase). If the symbol identifies an object in the current environment, its value is the mapped object.

These are examples of environment symbols:
Example 1.33. Environment symbols
.method    -- A reference to the Rexx Method class
.true      -- The Rexx "true" object.  Has the value "1"
.xyz       -- Normally the value .XYZ
.3DGlasses -- Normally the value .3DGLASSES

When you use an environment symbol, the language processor performs a series of searches to see if the environment symbol has an assigned value. The search locations and their ordering are:
  1. Constants .true, .false and .nil.
  2. The list of classes declared on ::CLASS directives within the current program package or added to the current package using the addClass or the addPublicClass method.
  3. The list of public classes declared on ::CLASS directives of other files included with a ::REQUIRES directive or added to the current Package instance using the addPackage method.
  4. The list of public Rexx supplied classes in the REXX package, like Object, String, or Array.
  5. The package local environment directory specific to the current package. You can access the package local environment directory through the Package local method with .context~package~local.
  6. The local environment directory specific to the current interpreter instance. The local environment includes instance-specific objects such as the .INPUT and .OUTPUT objects. You can access the local environment directory by using the .LOCAL environment symbol.
  7. The global environment directory. The global environment includes Rexx supplied objects like .endofline or the .RexxInfo object. You can access the global environment by using the .ENVIRONMENT environment symbol. Entries in the global environment directory can also be accessed via the VALUE built-in function by using a null string for the selector argument.
  8. Rexx defined symbols. Other simple environment symbols reserved for use by Rexx, including .RS, .LINE, .METHODS, .ROUTINES, .RESOURCES, and .CONTEXT.

If an entry is not found for an environment symbol, then the default character string value is used.

You can place entries in any of the three directories, the package local, the .LOCAL, and the .ENVIRONMENT directory, for programs to use, with package local preferred over .LOCAL, and .LOCAL preferred over .ENVIRONMENT. To avoid conflicts with future Rexx defined entries, it is recommended that the entries that you place in any of these directories include at least one period in the entry name, for example:
-- establish settings directory
.local~setEntry("MyProgram.settings", .directory~new)