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



I like this too - in fact, I'm thinking of writing up something for our customers, like you, Joel, that are using our DOCSQL command - very slick technique!

I don't see this being widely used, however.

Vern

On 4/2/2012 10:49 AM, Stone, Joel wrote:
That looks pretty good - is this method widely used in the /400 community for building SQL command strings?




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Monday, April 02, 2012 10:45 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Is there a better way to run SQL in a CL pgm?

On 01-Apr-2012 17:41 , Jack Callahan wrote:
Have you considered using RTVMSG? Used to use this technique to setup
the QRYSLT parameter of the OPNQRYF command .


Tweak your message to as needed to get the parameter lengths and
quotes correct.

ADDMSGD MSGID(TMP0001)
MSGF(mylib/mymsgf)
MSG('SQL STRING for my CL program.')
SECLVL('UPDATE TESTFILE
SET LG_ERRMSG=''&1'' LG_ERPATH=''&2''
WHERE LG_DATE=&3 AND LG_TIME=&4 AND LG_ID=''&5''
AND LG_SEQ=''&6'' AND LG_CLIENT=''&7''')
FMT((*CHAR 7) (*CHAR 10) (*CHAR 10) (*CHAR 10)
(*CHAR 10) (*CHAR 10) (*CHAR 10))

<<SNIP>>
If using that technique, surely the use of *QTDCHAR data type for the
message data fields representing quoted character string literals would
be better, to also avoid the escaped apostrophes in the ADDMSGD?

ADDMSGD
...
SECLVL('UPDATE TESTFILE
SET LG_ERRMSG=&1, LG_ERPATH=&2 ...
FMT((*QTDCHAR 7) (*QTDCHAR 10) ...

Regards, Chuck

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.