× 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 11 May 2012 12:01, Stone, Joel wrote:
There MUST be a better method of coding SQL in a CL source member.

<<SNIP>>

In the example below, is there a simple way to copy everything
between the "/*" to a source member and run that?

Or any other method to keep the CL together with the SQL commands in
the same member - without using quotes or tcat's.


Something like the following; i.e. would like to run this nice
readable SQL command in CL without the quotes and tcat's:

PGM
DCL &SQLCMD type(*CHAR) len(1000)

//start SQL
/*

create table qtemp/sqltemp1
(fld1 char(1)
,fld2 char(1)
,fld2 char(1)
,client numeric(6,0)
)

/*

RUNSQL


With the above, use a batch stream with //DATA commands to define those source rows as data for the inline data file. Or [write and] use a CL interpreter [without a //BCHJOB] preferably with some support included, to generate temporary source members for embedded //DATA commands.

Of course just switching to REXX would be simpler than either of those.

Or perhaps create the program from the output of a source pre-processor instead of that source directly. Then the SQL can be defined as rows of data like shown above, even in a separate /INCLUDE member, or perhaps defined similarly but using macroinstructions to identify and possibly assign the statement to an identifier which could be referenced on later commands. A pre-processor could generate the rows as strings using line continuation while handling apostrophes and concatenations as necessary; i.e. would still composed as a CHGVAR in the eventual source, but via a program rather than the programmer. Or it could even be as sophisticated as an effective SQL pre-compiler. The original pre-processor [macro]instructions can be omitted entirely from the eventual source that will be compiled, or could be wrapped inside of paired comments either on successive lines or with.... line continuation ;-)

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.