At 01:18 PM 1/22/2009, Alastair Burr wrote:
I'm sure that Razzak has been through this time and again but maybe it would be nice to have explained why the R:Base default is ON. I guess that many, if not most, programmers won't change any default unless they have a good reason - which means coming up against a problem which a change solves...
Alastair, et el. What makes R:BASE the most powerful SQL command interpreter is its ability and flexibility to adapt to your code & programming habits, to your heart's content. You can have your cake and eat it too. By default, R:BASE Engine's WHILEOPT setting is SET to ON. The most important reason is to improve the optimization and processing of WHILE ... ENDWHILE loops within an application by simply pre-compiling all variables used within the WHILE loop. However, to take advantage of such built-in features as default, the programmer MUST follow these guidelines: . Don't clear your WHILE variable(s). . Don't define variables within your WHILE loop, only outside the loop; values can change within the loop. . Don't change the data type or assign incompatible data type values on the right side of the "=" sign in expression within your WHILE loop. . Adhere to the syntax rules for the SWITCH statement by making sure that the argument for the SWITCH statement is an expression. . If you issue multiple SET VARIABLE commands on a single command line, those variables will not be optimized. If you want to increase the speed for that loop, put those SET VARIABLE commands on separate lines. . The WHILEOPT setting must be changed in a command file. The setting cannot be saved to the RBASE.CFG file. Having said that, if your legacy code or your programming habits do not comply with the rules defined above, you can always set the WHILEOPT setting to OFF, and move on. I NEVER set WHILEOPT to OFF. If you noticed, I provided two (2) examples to demonstrate the technique to achieve your goal. You have to adapt the procedure that fits your programming style. Very Best R:egards, Razzak.

