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



On 17 May 2012 08:32, Mark S Waterbury wrote:

You could use the CL CALL command to implement a very simple syntax
for "embedded SQL" in CL programs, like this:

CALL SQL PARM( SELECT DISTINCT * FROM 'QGPL/QAUOOPT' )

Leverage what the CALL command provides by writing a little "SQL"
program that concatenates all of its arguments, (e.g. using *BCAT),
to form the SQL query string to pass to your RUNSQL command (or the
one now provided by IBM.)

To ease the use of single-quotes, use a "special value" of *QUOTE,
that tells the SQL program to "en-quote" the next argument ... so in
this case:

CALL PGM(SQL) PARM( SELECT * FROM 'QGPL/QAUOOPT' +
WHERE OPTION = *QUOTE &OPT )

the value of &OPT will have single-quotes around it in the query
string.

<<SNIP>>

While the idea may seem somewhat generally plausible, IMO that design fails too easily. As both the variety and complexity of the statements increase, many irritating issues\restrictions\nuances and straight-up problems would almost surely plague the user. Certainly what would be required is non-intuitive for having to delimit things that otherwise might not be just to maintain case, allow special characters, or just to allow them to be accepted by the command parser as arguments; or uppercase the normally non-delimited values because they are now passed as separate strings. And the ever unpleasant issue with the 32-byte allocation default for variables would probably get overlooked exceedingly often, resulting in unpredictable results just like so often when CALL is used with variables in place of *CMD parameters.

Regards, Chuck

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.