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



Thanks Lloyd,

I'll try again hopefully that will be clearer.

I have this code in another procedure that works :
SAY "Entrer numéro de début..."
PULL START
SAY "Entrer numéro de fin..."
PULL FINISH
DO I = START TO FINISH
wSQL = "INSERT INTO QTEMP/COMPTEUR VALUES("I") WITH NC"
ADDRESS EXECSQL,
EXECSQL wSQL

END


So I thought I could construct whatever instruction I wanted in a clp and just pass that instruction to the REXX procedure.

For example,
CHGVAR VAR(&wSQL) VALUE('CREATE TABLE QTEMP/COMPTEUR +
(NUMERO INT NOT NULL WITH DEFAULT)')
STRREXPRC SRCMBR(EXECSQL) PARM(&wSQL)


Then I saw :

From Joe Pluta
Remove the quotes around wSQL?

That works ! <sigh>

It didn't have the quotes at first, I don't know what was wrong.

The syntax in REXX seems to be very delicate.

Thanks for all your help.


-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de lgoodbar@xxxxxxxxxxxxxx
Envoyé : mercredi 30 avril 2008 14:29
À : midrange-l@xxxxxxxxxxxx
Objet : RE: REX problem

If you want to run a SELECT statement, it's a good idea to prepare it first.

For example (no error checking):
appctlstatement = "select axascd from vngdbdta/dbaxrep where axazcd='WV '"
address execsql
execsql 'set option commit=*none, naming=*sys;'
execsql 'prepare s1 from :appctlstatement;'
execsql 'declare c1 cursor for s1;'
execsql 'open c1;'
execsql 'fetch c1 into :currentyear;' /* Only one row returned. */ execsql 'close c1;'

If you want to perform DDL functions, such as create table or alter table, you say:
Execsql 'execute immediate :statement;'

What statements are you passing in?

HTH,
Loyd


Loyd Goodbar
Business Systems
BorgWarner Shared Services
662-473-5713
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Wednesday, April 30, 2008 4:48 AM
To: Midrange Systems Technical Discussion
Subject: REX problem

Hey isn't it possible for a REX procedure to execute, or try to, whatever SQL command I choose to pass to it ?


I'm trying this but getting SQL0204


PARSE ARG wSql

RC=0

ADDRESS EXECSQL,

EXECSQL,

"wSql"

IF RC <> 0 THEN DO

MSGID = "SQL"RIGHT(STRIP(ABS(SQLCODE)),4,'0')

'SNDPGMMSG MSGID(&MSGID) MSGF(QSQLMSG) MSGDTA(&SQLERRMC) MSGTYPE(*ESCAPE)'

END




--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.