Thanks Lloyd,
I'll be sticking to my original command with a CL as a CPP. Imagine this command :
RUNSQL2 CMD('update truc set ma=''hello'' where myzone = ''blah blah''') etc, it's simply unworkable.
But thanks for the interesting REXX functions that I completely ignored the existance of until now.
-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de lgoodbar@xxxxxxxxxxxxxx
Envoyé : vendredi 10 octobre 2008 14:27
À : midrange-l@xxxxxxxxxxxx
Objet : RE: REXX QIBM_REX_FIND_SRCMBR
Hi David,
I was unable to reproduce that problem.
RUNSQL2 CMD('update truc set ma=''hello''') update truc set ma=''hello''
Press ENTER to end terminal session.
However, there are many ways to handle the quote issue. Here is one I've used with great success.
Put this at the very bottom of your REXX procedure.
return
/* -------------------------------------------------------- */
/* Strip surrounding single quotes from command parameters. */
/* -------------------------------------------------------- */
stripquotes: procedure
parse arg parm
rparm = parm
if left(rparm,1)="'" then
rparm=substr(rparm,pos("'",rparm)+1,lastpos("'",rparm)-2)
return rparm
Now you have a custom function that can be used in the program:
iSql = stripquotes(iSQL)
Here is a sample program.
parse arg 'CMD('iSql')'
say iSql
iSql = stripquotes(iSql)
say iSql
return
/* -------------------------------------------------------- */
/* Strip surrounding single quotes from command parameters. */
/* -------------------------------------------------------- */
stripquotes: procedure
parse arg parm
rparm = parm
if left(rparm,1)="'" then ,
rparm=substr(rparm,pos("'",rparm)+1,lastpos("'",rparm)-2)
return rparm
Now when I run it:
RUNSQL2 CMD('update truc set ma=''hello''') 'update truc set ma=''hello'''
update truc set ma=''hello''
Press ENTER to end terminal session.
Hopefully using the stripquotes procedure will work for you.
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: Friday, October 10, 2008 2:50 AM
To: Midrange Systems Technical Discussion
Subject: RE: REXX QIBM_REX_FIND_SRCMBR
Thanks Lloyd. That works for the given example.
But something's still not quite right.
If I try MYREXCMD CMD('update truc set ma=''hello''') REX will SAY update truc set ma=''l''
And obviously the SQL will not run. I can't see how to eliminate the extra quote marks.
The same command runs fine in my command with a CL as CPP.
--
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.