Thanks Lloyd,
I have this code in another procedure that works :
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.
-----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.