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

I try to get the row count from the SQLCA in a SQLRPGLE program in which I
build my Select statement dynamically in a string. The program works fine
but I want to get the row count from the SQLCA before trying to fill my
subfile with my Select result.

I know that row count is usually in SQLER3 (I think so) but when I try to
get this value before my FETCH loop, the value is 1.

This is what I do:

Eval SQLSTR = 'SELECT MY_DATA FROM MY_TABLE'
C/EXEC SQL PREPARE S1 FROM :SQLSTR
C/END-EXEC
C/EXEC SQL DECLARE C1 CURSOR FOR S1
C/END-EXEC
C/EXEC SQL OPEN C1
C/END-EXEC
C/EXEC SQL FETCH C1 INTO :SQLREC
C/END-EXEC
C                   DUMP

When I look at the result of the DUMP operation, SQLER3 = 1 but in fact the
result should be 2... why?

Thanks for your help
Charles




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.