On 03/04/2008, at 8:47 AM, Tom Liotta wrote:
One thing that isn't clear to me is what happens when repeated
ADDRESS statements refer to the _same_ environment that is already
saved as the 'permanent' environment. I.e., what is the result of
saying ADDRESS COMMAND when COMMAND is already the environment?
Has no effect. Rexx supports 3 environment states: ACTIVE, ALTERNATE,
and TRANSIENT.
ACTIVE is either the one it starts with or the one assigned via
ADDRESS env-name. ALTERNATE is the one that existed prior to a
change. At program start ACTIVE and ALTERNATE are the same. TRANSIENT
is the environment used for the running of a specific command or
statement such as:
ADDRESS *COMMAND 'DSPMSG'
This environment lasts only for the duration of the statement.
If ACTIVE is currently *COMMAND and you issue ADDRESS COMMAND then it
stays ACTIVE. Effectively a NO-OP.
And then what happens when a later ADDRESS EXECSQL is thrown in?
*EXECSQL becomes the ACTIVE environment and the previous becomes the
ALTERNATE. Issuing ADDRESS on its own toggles between them.
And what happens when the environment is reverted back to the
previous?
In what way. The previous is now the ACTIVE and the old active is now
the ALTERNATE.
It gets a bit messier with *COMMAND, *EXECSQL, and *CPICOMM in the
same Rexx program because only one can be ACTIVE, one can be
ALTERNATE and the other is simply dropped. In these cases you would
set ACTIVE and ALTERNATE to the most used and use TRANSIENT for the
other(s).
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.