× 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 am new to using embedded SQL, and am trying to learn it in baby steps.
I did get my first program with embedded RPG to work fine. It retrieves a
single value from a database record in a physical file.
Compiled, works fine as long as the record is found.

If the record is not found I get error: SQLSTT = 58004 SQLCOD = -901

Is it normal to get these when no record is retrieved by the SQL
And I just need to monitor for them and program accordingly?
It will be normal that the record may not exist and I do have specific code
for no record found conditions.
I just want to make sure I am handling this type of error correctly.

My test Code snipet:

C eval W$SQLCmd = 'Values ( Select '+ P$FLDNM
C + ' from ' + P$FILNM
C + ' Where ' + W$KEYFLD + '=?'
C + ') into ?'
*
C/exec SQL
C+ Prepare W$MYSTMT from :W$SQLCmd
C/End-Exec
*
C/exec SQL
C+ execute W$MYSTMT Using :P$KEYVALUE, :P$RTNVALUE
C/End-Exec

*
C eval W$WrkDsp = 'SQLSTT = ' + SQLSTT
C + ' SQLCOD = '
C + %char(SQLCOD)
C W$Wrkdsp dsply


Thanks
John



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.