× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



lgoodbar wrote:

If I say "ADDRESS EXECSQL" at the top of a Rexx program, then I can run
SQL statements fine. Prefixing i5/OS commands with ADDRESS COMMAND works
well also.

However, if I use just ADDRESS COMMAND at the beginning of a program,
then ADDRESS EXECSQL statements return with RC(-10).

Interesting. I've not noticed this before, probably because I couldn't think of any reason ever to put ADDRESS COMMAND as the first ADDRESS statement. That sets the 'permanent' environment to the environment that it's already set to. Except...

Then I thought in terms of multiple procs where COMMAND might not be the current 'permanent' environment upon entry to some lower-level procedure.

Hmmm...

In looking over the docs (REXX reference), I see:

"
With no arguments, commands are routed back to the environment that was
selected before the previous lasting change of environment was made, and
the current environment name is saved. After changing the environment,
repeated execution of ADDRESS alone, therefore, switches the command
destination between two environments alternately. A null string for the
environment name ("") is the same as the default environment COMMAND.

The two environment names are automatically saved across internal and external subroutine and function calls. See the CALL
instruction (topic 3.3) for more details.

The address setting is the currently selected environment name. You can retrieve the current address setting by using the
ADDRESS built-in function (see topic 4.3.3).
"

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? And then what happens when a later ADDRESS EXECSQL is thrown in? And what happens when the environment is reverted back to the previous?

I'm thinking that you might want to make use of the third paragraph.

Only specify ADDRESS COMMAND (or ADDRESS EXECSQL) when the ADDRESS bif indicates that a change would make sense.

Maybe?

Tom Liotta


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.