The Local Directory (.LOCAL)

The Local environment object is a directory of process-specific objects that are always accessible. You can access objects in the Local environment object in the same way as objects in the Environment object. The Local object contains the .INPUT, .OUTPUT, and .ERROR Monitor objects used for Rexx console I/O, the .STDIN, .STDOUT, and .STDERR output streams that are the default I/O targets, and the .STDQUE RexxQueue instance used for Rexx external queue operations.

Because both .ENVIRONMENT and .LOCAL are directory objects, you can place objects into, or retrieve objects from, these environments by using any of the directory methods ([],[]=, PUT, AT, SETENTRY, ENTRY, or SETMETHOD). To avoid potential name clashes with built-in objects and public objects that Rexx provides, each object that your programs add to these environments should have a period in its index.

Examples:

/* .LOCAL example--places something in the Local environment directory */
.local~my.alarm = theAlarm
/* To retrieve it                                                      */
say .local~my.alarm
/* Another .LOCAL example (Windows) */
.environment["MYAPP.PASSWORD"] = "topsecret"
.environment["MYAPP.UID"] = 200

/* Create a local directory for my stuff */
.local["MYAPP.LOCAL"] = .directory~new

/* Add log file for my local directory                                 */
.myapp.local["LOG"] = .stream~new("myapp.log")
say .myapp.password                    /* Displays "topsecret"         */
say .myapp.uid                         /* Displays "200"               */

/* Write a line to the log file */
.myapp.local~log~lineout("Logon at "time()" on "date())

/* Redirect SAY lines into a file:  */
.output~destination(.stream~new("SAY_REDIRECT.TXT"))
say "This goes into a file, and not onto the screen!"