Karen, What versions are you using? Earlier versions have a problem that automatically created "#nnn" temporary tables to support some views and cursor definitions. The temporary tables were not removed after use and affected the stability of the system. This affected DOS and Windows versions (32bit & 64Bit). A fix was issued for DOS v9.1 and Windows v9.x, to the best of my memory, some time in 2011. To check this SELECT COUNT(*) FROM SYS_TABLES WHERE (SGET(SYS_TABLE_NAME,1,1))='#'
after system fails and before you disconnect as disconnecting will remove all temporary tables. You mention that you tried it in Windows. Was that the 32bit version of the 64bit version. In the Windows 32 bit version you may be encountering one or more limits. See http://rbase.com/rbg95/compare.php which spells out size limitations. Normally the number of rows in the table should not affect the cursor except if the code creates temporary tables as outlined above. I was the identifier of the If this is extremely old code or code that has been modified over time you might want to review the code to make sure that: * ALL variables used have been defined outside of loops (preferable in a block close to the beginning of the program). * Make sure that the data type for a variable is not changed once it is defined. * Make sure that no variables are deleted with loops * Make sure that all CURSOR definitions occur outside the loops * If you have nested CURSORs this could affect memory requirements * Are their any computed columnsin the table being processed by the cursor. If so they could be the source of the "#nnn" temporary tables I know the ideal is to have all parts of the system in the 64 bit version RBase for Windows. Since the commission calculation is being made on a copy of the database with importation of the final results back into the live database have you considered developing a STORED PROCEDURE to unload any required tables to a file and RELOAD them into a 32bit for DOS database and run the calculation, have a STORED PROCEDURE to export the results and a SOTRED PROCEDURE to re-import into the 64bit Windows version. Jim Bentley, American Celiac Society 1-504-737-3293 ________________________________ From: "[email protected]" <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Friday, August 10, 2012 9:16 AM Subject: [RBASE-L] - Cursor ideas? This client has a big database, needs to get to a 64-bit. The .rb2 file is usually 1.4 GB. However, they still have a major piece in DOS so we're still at 32-bit. We haven't yet been able to successfully "convert" the one DOS piece to windows. This is a commission program they run once a month (I did not write this program nor design the database). The DOS program creates a temp table, loads about 50K rows into it, then runs a cursor through every single row. They typically copy the database to a local drive and run the program, later just loading the data to the permanent table in the live database. The cursor runs through hundreds of lines of code to figure out the commission and even calls a couple other subroutines for certain situations. It takes a few hours to run, but it works. In Windows I've done the same thing -- copy the database to a local drive, step through the code. There are no errors generated, the code seems to work perfectly fine in windows. But at some point maybe 2/3 of the way through the cursors, the program will lock up. Never once have we gotten it to complete. I took the subroutine code and put it right in the cursor so that it wouldn't have to call other external programs. I changed it to be a permanent table rather than a temp table. Nothing so far has made it go all the way through. I'm sure some of this code is maybe inefficient or can be replaced with some update commands up front that might make the code faster, but it probably won't diminish the number of rows to cursor through. I've never seen so much complicated machinations going on just to calculate a commission! I hope I don't have to try to understand this code and come up with alternatives! I'd like to just get the cursor to finish (admit it -- I'm lazy). Anyone have ideas or settings I can try to get this thing to get through all rows? I have never before tried to run a cursor with this many rows! Karen

