×
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 too got tired of trying to read the confusing *CATs, *TCATs, ||, and
+s need to include a SQL statement in CL. So, I wrote a little program
to imitate the substitution function that the RPG cursors do (we are
still on V5R4).
The process is setup so I can write a SQL command in a source file
member and add variables to it using the :name convention. You would
not necessarily need to use :name but it has worked well for me so far.
The first procedure takes a SQL source file member and copies it to a
temp name in a QTEMP source file. The second procedure takes the field
and its replacement value and changes any occurrences in the temp source
file member. The second procedure would be repeated as many times as
needed. After all of the substitutions have been completed, a third
procedure runs the SQL source file member using the RUNSQLSTM command
and then deletes the temp member.
The way the procedures work, the source file member can have multiple
SQL statements with each statement have a ";" at the end. The same
variable can be repeated in the source member if needed.
For example, below is one of my SQL source file members:
Source file: LEXCHGS/TXTSRC Member: LPD480P3E
*************** Beginning of data *************************************
****************** End of data ****************************************
I am sure I adapted (stole) a lot of the RPGLE coding from someone
else's previous example.
This process might not be the most elegant in the world but it helps me
wrap my mind around the SQL statement with out a lot of extra work.
It has sure saved me from a lot of errors and a lot of time in working
out the concatenation issue on my SQL. This is fairly simple and does
not have a lot of parts that might break.
Let me know if you would need further information.
Chuck Sallee
Lexington Police
Lexington, Kentucky
As an Amazon Associate we earn from qualifying purchases.
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.