The Local Environment Object (.local)

The local environment object .local is a directory (an instance of the Rexx Directory class) of interpreter instance-specific objects that are always accessible. To place something in the Local environment directory, you use the form:

.local~your.object = value

Include a period ( .) in any index name you use, to avoid conflicts with current or future Rexx entries to the local environment directory .local. In the above example the index name used for storing value within the local environment directory is YOUR.OBJECT. To retrieve the value stored with the index name YOUR.OBJECT from the .local directory, you use one of the following two forms:

say .local~your.object
say .your.object /* same as above */

The scope of .local is the current interpreter instance. Each Rexx interpreter instance has its own copy of the local environment directory .local.

You access objects in the .local directory like in the global .environment directory. Rexx provides the following objects in the local environment:

.input is the input monitor (an instance of the Rexx class Monitor) object which is the source for the PARSE LINEIN instruction, the LINEIN method and CHARIN method of the Stream class, and (if you do not specify a stream name) the LINEIN, respectively CHARIN built-in functions. It is also the source of the PULL and PARSE PULL instructions if the external data queue is empty. By default.inputforwards the received messages to the.stdinstream object.
.output is the output monitor (an instance of the Rexx class Monitor) object, which is the destination of output from the SAY instruction, the LINEOUT (SAY) and CHAROUT methods of the Stream class, and (if you do not specify a stream name) the LINEOUT built-in function. You can replace this object's destination to redirect such output elsewhere, for example to a transcript window. By default.outputforwards the received messages to the.stdoutstream object.
.error is the error monitor (an instance of the Rexx class Monitor) object to which Rexx writes error messages to. By default.errorforwards the received messages to the.stderrstream object.
.debuginput is the debug input monitor (an instance of the Rexx class Monitor) object from which the Rexx TRACE instruction reads debug input while in interactive mode. By default.debuginputforwards the received messages to the.inputmonitor object.
.traceoutput is the trace output monitor (an instance of the Rexx class Monitor) object to which Rexx writes trace output to. By default.traceoutputforwards the received messages to the.errormonitor object.
.stdin is the operating system's standard input stream (an instance of the Rexx class Stream), by default the keyboard input device. The standard input stream can be redirected via the operating system and has always the file descriptor value0.
.stdout is the operating system's standard output stream (an instance of the Rexx class Stream), by default the console (terminal) device. The standard output stream can be redirected via the operating system and has always the optional file descriptor value1.
.stderr is the operating system's standard error stream (an instance of the Rexx class Stream), by default the console (terminal) device. The standard output stream can be redirected via the operating system and has always the file descriptor value2.
.syscargs is optional and will be set by Rexx if the Rexx program was called with arguments from the commandline. Rather than returning the commandline argument as a single string like the ARG() built-in function does, .syscargsarray object will have the commandline argument string decomposed according to the rules of the programming languageC. If this environment object is not set, because there were no commandline arguments supplied, the name of the environment symbol will be returned instead in uppercase letters, i.e..SYSCARGS(note the leading dot which makes this symbol an environment symbol).
.SYSCARGS Environment Object Invoking the following Rexx program from the command line withrexx syscargs&per;cmd one "second argument" three "fourth argument" five
/* runnig this program from the command line:
rexx syscargs&per;cmd one "second argument" three "fourth argument" five
*/
/* syscargs&per;cmd */
if .sysCargs~isA(.array) then -- command line arguments parsed?
do
say "there are.sysCargs~items:" .sysCargs~items -- show number of arguments
say
do counter i val over .sysCargs -- show parsed arguments
say i":" val
end
end
Results:
there are.sysCargs~items: 5
1: one
2: second argument
3: three
4: fourth argument
5: five