|
The only problem with sqlstt = '00000' is that a warning message (like data conversion happening on a FETCH) will cause your loop to terminate when you may not want it to. Scott's example also has an issue. The issue is that if there is an I/O problem (like if you're connected to a remote machine) or a data issue that makes the query invalid, it will stay in the loop and reprocess the last read record. What I've found to be best is to check the first two characters (which are the error class) of SQLSTT to see if they are '00' (success) or '01' (warning). This, of course, begs the question: When do you know if it's okay to skip 01's? That answer requires that you take a look at the SQLSTT documentation (http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/rzala/ rzalastc.html -- I know this is for V5R1 but SQLSTT values are a standard and they don't change very often so this should be perfect for pretty much anyone on the list) and make an informed decision. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Carel Teijgeler Sent: Friday, September 16, 2005 12:32 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Last record keeps repeating It could be changed into >> if sqlstt = '00000'; Regards, Carel teijgeler *********** REPLY SEPARATOR *********** On 16-9-05 at 11:15 Scott Klement wrote: >> dow record_loop = 'Y'; >> c+ fetch next from maincursor into :main_ds >> if sqlstt <> '02000'; >> do whatever you do here >> else; >> // Leave loop >> endif; >> enddo; > >Won't this cause an endless loop if any error aside from EOF occurs?
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.