Karen, I did some more testing of the code I posted the other day and found some interesting info. My test of while loops using both scenarios indicated that there was no real advantage using the single text vs. the double test.
I decided to try the loops including a fetch statement. To my surprise, the double fetch with one test bested the single fetch with 2 tests, taking 2/3 the time to complete. With whileopt on it improved to 1/10. That is an order of magnitude which is a worthwhile improvement in anybodies book. I also found that using an ampersand variable to hold the fetch statement, negated the improvement so we cannot use that method to avoid maintaining two copies of the fetch. I guess one cannot avoid retesting ones assumptions now and then. Apparently whileopt greatly reduces the overhead of the fetch statement. While I probably won't write double fetch loops as a general rule, I will remember this when I have a loop that takes a less than trivial amount of time, and try both ways, documenting why I used a double fetch version and why. Dennis McGrath ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Friday, June 19, 2009 12:22 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Converting from pointer to fetch Dave: As we found out from the recent batch of comments on this subject, the WHILE SQLCODE <> 100 works *ONLY* if the "fetch" statement is the last command before the ENDWHILE. Some people, including myself, don't program that way because it requires you to have 2 fetches in the code. Karen Hi, I too am converting an old database with lots of SET POINTER commands. What I have found works is to use: WHILE SQLCODE <>100 THEN In place of any old line that looks like WHILE var = 0 THEN This seems to run the cursor/pointer through the data and stop at the end without any problems. Regards, Dave Fitts State of Maine

