× 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.



Simon,

Here is a code excerpt that works:
------
Address execsql
Address command "clrpfm file1"
Mystatement="select axascd from vngdbdta/dbaxrep where axazcd='WV'"
Execsql "set option commit=*none, naming=*sys;"
Execsql "prepare s1 from :mystatement;"
Execsql "declare c1 cursor for s1;"
Execsql "open c1;"
Execsql "fetch c1 into :currentyear;"
Execsql "close c1;"
Address command "strqmqry qmqry(s9sales)""
------

This code does not.
------
Address command
"clrpfm file1"
Mystatement="select axascd from vngdbdta/dbaxrep where axazcd='WV'"
Address Execsql "set option commit=*none, naming=*sys;"
Address Execsql "prepare s1 from :mystatement;"
Address Execsql "declare c1 cursor for s1;"
Address Execsql "open c1;"
Address Execsql "fetch c1 into :currentyear;"
Address Execsql "close c1;"
"strqmqry qmqry(s9sales)""
--------

Based on your and Tom's later email (active versus alternate
environments), and sending statements to the current environment. This
does not work for SQL. Even with the execsql environment specified, one
must explicitly specify the execsql environment when running SQL
statements. (See next code block.)
------
address command
"clrpfm s9sales"
mystatement="select axascd from vngdbdta/dbaxrep where axazcd='WV'"
address execsql
"set option commit=*none, naming=*sys;"
"prepare s1 from :mystatement;"
"declare c1 cursor for s1;"
"open c1;"
"fetch c1 into :currentyear;"
"close c1;"
Address /* Swap to command environment. */
"strqmqry qmqry(s9sales)"
--------

This works.
--------
address command
"clrpfm s9sales"
mystatement="select axascd from vngdbdta/dbaxrep where axazcd='WV'"
address execsql
execsql "set option commit=*none, naming=*sys;"
execsql "prepare s1 from :mystatement;"
execsql "declare c1 cursor for s1;"
execsql "open c1;"
execsql "fetch c1 into :currentyear;"
execsql "close c1;"
address /* Swap to command environment. */
"strqmqry qmqry(s9salesqm)"
-------

I was curious specifically on using the execsql environment, the rules
for its interaction with other environments. As your next email
inferred, I am using both the command and execsql environments in the
same script.



Loyd Goodbar
Senior programmer/analyst
BorgWarner
TS Water Valley
662-473-5713

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Simon Coulter
Sent: Wednesday, April 02, 2008 18:44
To: Midrange Systems Technical Discussion
Subject: Re: Rexx address command versus execsql


On 03/04/2008, at 6:08 AM, <lgoodbar@xxxxxxxxxxxxxx>
<lgoodbar@xxxxxxxxxxxxxx> 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).

I think I no the problem. I also have an OPINION on the behaviour of
EXECSQL in Rexx. Show me some source so I can be sure.

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.

This thread ...

Follow-Ups:
Replies:

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.