Don't you need an "into" somewhere, so that your selected data ends up in a variable in the program?

Sam

On 6/21/2010 7:54 PM, Darryl Freinkel wrote:
I have a relatively simple SQL statement that works fine in interactive SQL
and iNavigator.



However, in a RPG program (free form) that is using a prepare and EXECUTE,
the EXECUTE fails with error -518.



This error is used for a number of errors by IBM and I cannot find a
specific error code indicating the problem.



Select RRN(A1) from OEDTL01P A1 right outer join AA0000219 B1 on A1.ODORD =
B1.LORD and A1.ODLINE = B1.LLINE where RRN(B1) = 55243



Here is the code:



Exec Sql Declare SQLRRN scroll cursor for SQLRRN;

Exec Sql Prepare SQLRRN from :SqlRRNPrep;



If SqlCod< 0;

ErrorStatus = '1003';

p1SqlCmd = sqlRRNPrep;

logACTerr ('1003' : SqlCod : p1SqlCmd );

ReturnCode = *off ;// Failed

Return ReturnCode;

Else;

Exec Sql Execute SQLRRN ;

If SqlCod< 0;

ErrorStatus = '1004';

ENDIF;


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.