|
Hi guys, >>The line with SQLCOD should read: "Dow SQLCOD = 0" I've now read in several answers to use SQLCOD = *Zeros. You should avoid this and either use SQLCOD = 100 to check if not found or even better to use SQLSTT '2000'. To detect an error you have to check for a negative SQLCOD. Beginning with release V5R1M0 there are several situations where a row is returned, but an SQLCOD between 1 and 99, a warning, is sent. For example you'll get SQLCOD 30, if you join two files and only read the information of the first one into an external data structure. D DSFile1 E DS ExtName('FILE1') C/EXEC SQL C+ Declare CsrC1 Cursor for C+ Select * C+ from File1 join File 2 on File1.Key = File2.Key C+ Where File1.Fld = 'XXX' and File2.Fld = 'ABC' C/END-EXEC C/EXEC SQL Open CsrC1 C/END-EXEC C/EXEC SQL Fetch Next From CsrC1 Into :DSFile1 C/END-EXEC --> SQLCOD is now 30, but the row is returned!!! By the way, to learn embedded SQL there are several redbooks where also a lot of examples can be found: Who Knew You Could Do That with RPG IV? A Sorcerer's Guide to System Access and More http://www.redbooks.ibm.com/abstracts/sg245402.html?Open Modernizing IBM eServer iSeries Application Data Access - A Roadmap Cornerstone http://www.redbooks.ibm.com/abstracts/sg246393.html?Open Birgitta
As an Amazon Associate we earn from qualifying purchases.
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.