Product Site

6.2. The Local Directory (.LOCAL)

The Local environment object is a directory of interpreter instance 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

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.
Example 6.1. .LOCAL
/* .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!"
/* .LOCAL example--get the individual command line arguments */
cmdargs = .local~syscargs
do carg over cmdargs
   say carg
end