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



Hi everyone,

The program that I currently updating contains the following SQL statement.

exec sql
DECLARE housesBefore CURSOR for
SELECT ALAJNB,
ALBHNB,
ALBFCD,
ALBGCD,
ALBKCD,
ALBLTX,
ALBMTX,
ALBNTX
FROM homrtv01
WHERE ((upper(ALBFCD) < :@AddrLoc) or
(upper(ALBFCD) = :@AddrLoc and
upper(ALBGCD) < :@Fraction) or
(upper(ALBFCD) = :@AddrLoc and
upper(ALBGCD) = :@Fraction and
upper(ALBKCD) <= :@Apartment)) and
upper(ALBHCD) = :@PreDirect and
upper(ALBITX) like '%' || trim(:@StrWord1) || '%' and
upper(ALBITX) like '%' || trim(:@StrWord2) || '%' and
upper(ALBITX) like '%' || trim(:@StrWord3) || '%' and
upper(ALBITX) like '%' || trim(:@StrWord4) || '%' and
upper(ALBITX) like '%' || trim(:@StrWord5) || '%' and
upper(ALBJTX) = :@City and
upper(ALBICD) = :@State and
ALBTST = ' '
ORDER BY upper(ALBFCD) desc,
upper(ALBGCD) desc,
upper(ALBKCD) desc;


exec sql open housesBefore;

dou sqlstt <> '00000';

exec sql
fetch housesBefore into :houseData;

if sqlstt = '00000';


The SQL statement works correctly, but I need to add additional selection criteria information into it but I've been encountering issues with the formatting of the select statement and was wondering if there is a way through debug to see the actual SQL statement that is being created so that I can determine where the formatting problem is so that I can fix it.

I'm using STRDBG command to view the variables in the program.


I've worked on SQLRPGLE programs where I've build the select statement from scratch and then declared it to a cursor. For example:
Prepare sel from :selectStmt
Declare c1 cursor for sel


With this method I was able to debug my SQL statement that was built by using the EVAL on the selectStmt variable.

Any help on how to display the select statement that is being built without having to update the current program to move the select builds into a variable would be appreciated.

Thank you

_____
Kimberly Fry



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.