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



First: V5R1



I have a simple (I thought) SQLRPGLE program that is supposed to select all
of the records from our Item Master, put them in order, and then use the
retrieved records to print a report. Done this a few dozen times in the
past, but this time no dice. Under debug the program ends (normally, not an
abend) when I test the value of SQLSTT, which is 24501 (Cursor is not open).



Relevant, I think, code:



<code>

$BuildSQL();



/end-free



C/Exec SQL

C+ Prepare MySQLStmt from :SQLString

C/End-Exec

C/Exec SQL

C+ Declare NVList Cursor for MySQLStmt

C/End-Exec

C/Exec SQL

C+ Open NVList

C/End-Exec



/free



DOW 1 = 1;



/end-free



C/Exec SQL

C+ Fetch Next from NVList into :NVLine

C/End-Exec



/free



IF SQLStt = '02000' OR SQLCOD < *Zeros;

</endcode>



The $BuildSQL subprocedure successfully builds the SQLString value:

SELECT imloc, imdesc, imumi, imbal, impidx, impitm, imclas,

FROM "A.IVMAST" ORDER BY imloc, impitm FOR Read Only



NVLine is a data structure with the field names equivalent to the SELECT
with the proper attributes and order.



SQLSST = '24501' and SQLCOD = -501 under debug. Both of which mean that the
sursor is not open.



This is a single mod program; the only subprocedure is $BuildSQL which only
creates the SQLString. The code snippet is from a subroutine. So I don't
see that the cursor could be closed by ending the activation group, which
was the compile option.



I have compared this to similar programs I wrote using the same methodology.
I, also, know/suspect that I am overlooking the obvious and will be
embarrassed when we find out what is wrong, but I have looked at this and
debugged it for the last hour.



Thanks.



Jerry C. Adams

IBM i Programmer/Analyst

Never argue with a women when she's tired -- or rested.


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.