Frank, In my experience exiting a while loop with a goto or a quit to is asking for problems in R:Base, especially with WhileOpt ON.
I use goto and quit when it seems appropriate with Switch and If statements -- but outside of a while loop. Never had a problem inside a Goto loop so I have changed while loops to goto loops when necessary. I don't know if it is right, but it has worked for 12 years. :-) Michael Michael Moser EXAQ Micro Services www.exaq.com Phone: 916-966-8313 Fax: 916-244-0582 >> Eating humble pie now. I used to program in assembly and you guys are all >> so >> right, most of that code consists of "jmp"s. >> Just a bit concerned that if I jump out of a while loop that I am leaving >> stuff behind, such as open cursors, which later bite me in the bum. :) >> >> Frank >> -----Original Message----- >> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bernie >> Corrigan >> Sent: Thursday, 26 May 2005 11:42 a.m. >> To: [email protected] >> Subject: [RBG7-L] - Re: R:Base 7.5/7.1 creates 2 GB swap file onexit >> Frank - >> I used to teach structured programming. >> In some languages perfectly structured coding leads to disasters. In >> RBase >> 6.5++ it leads to crashing out to the desktop on the third repetition of >> using a form heavily laden with eeps within a WHILE loop. QUIT TO >> resolves >> the problem. I have no idea why. It just does. >> The choice seems one of being >> politically correct versus having a working application. You should note >> that when you program in assembly language, jumps (GOTOs) and jump to >> subroutine with no return to the current routine (QUIT TO) are the way it >> actually works at the machine language level (in addition to JSR with >> normal >> return). >> So without wanting to start lecturing ;), so called spaghetti code >> is sometimes required so that the app runs at all. If it is well >> documented >> and written clearly in the same manner as normally structured code there >> should be no problems. Most (or all) of the "spaghetti" >> code I've encountered in systems I've taken over has no documentation and >> often has two or more commands per line. It is sloppily written and >> difficult to figure out. >> Bernie >> --------------------------------------- >> At 10:46 AM 5/26/2005 +1200, Frank wrote: >> >Bernie, >> > >> >Without wanting to start lecturing, isn't "quit-to" equivalent to >> >getting of the motorway by driving of the shoulder, through the grassy >> >area, over the plants, and through the bushes straight into the garage? >> >Similarly isn't the "goto" statement like crossing the median strip on >> >the motorway and do a u-turn? I have seen somebody doing this on the >> >Super Motor Highway outside Manila and as a result was stuck in a traffic >> jam for nearly 11 hours. >> > >> >Point I am getting at is that I believe that these commands could cause >> >unpredictable shortcuts in your code and encourages spaghetti >> programming. >> >It may take a bit more code without using goto and quit-to constructs, >> >but believe me, longer term it makes the job of programming and >> >maintenance much easier. >> > >> > >> >Frank van der Zwaag >> > >> > >> > >> >-----Original Message----- >> >From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Bernie >> >Corrigan >> >Sent: Thursday, 26 May 2005 10:19 a.m. >> >To: [email protected] >> >Subject: [RBG7-L] - Re: R:Base 7.5/7.1 creates 2 GB swap file onexit >> > >> >David - >> > >> > There are a number of places in my 6.5++ apps where I quit to >> >the current routine. It clears all open IFs, WHILEs, and RUNs. In >> >fact it is the only way I can get forms which have a lot of eeps to run >> >properly when the form is used in an iterative fashion. >> >Sounds to me like in 7.1 QUIT TO may no longer be clearing the open >> >processes. >> > >> >Bernie >> > >> > >> > >> >At 02:37 PM 5/25/2005 -0400, you wrote: >> >>Michael >> >> >> >>I assume we're LOOKING at MAIN.CMD? >> >> >> >>If so, it's defintely a no no to QUIT TO MAIN.CMD from within MAIN.CMD!! >> >>Why would you do that? If you want it at that point to start over at >> >>the beginning of the file, just add >> >> >> >>LABEL TOP at the top >> >> >> >>and replace >> >> >> >>QUIT TO MAIN.CMD with GOTO TOP >> >> >> >>QUIT TO MAIN.CMD belongs at the END of the sub-routines you call from >> >>MAIN.CMD so it will return to the main menu program. >> >> >> >>David >> >> >> >>David Blocker >> >>[EMAIL PROTECTED] >> >>781-784-1919 >> >>Fax: 781-784-1860 >> >>Cell: 339-206-0261 >> >>----- Original Message ----- >> >>From: "Michael Moser" <[EMAIL PROTECTED]> >> >>To: "RBG7-L Mailing List" <[email protected]> >> >>Sent: Wednesday, May 25, 2005 1:48 PM >> >>Subject: [RBG7-L] - R:Base 7.5/7.1 creates 2 GB swap file on exit >> >> >> >> >> >>Here is an odd one - R:Base 7.1 or 7.5 running under XP Pro SP2 >> >> >> >>This is part of a file that loops back on itself to redisplay a menu. >> >>I have used this same process successfully in R:Base 6 without problems. >> >> >> >>If the "Quit to Main.cmd" is simply in the program and the "Exit" line >> >>is executed, R:Base brings the system to it's knees for about 3 >> >>minutes while 2 GB is written to the swap file then deleted. Then all >> >>is back to >> >normal. >> >> >> >>if the "Quit to Main.cmd" line is commented out the "Exit" command >> >>works fine, no delays. I can't see a reason for this as the "Quit" >> >>command is farther down in the code and should never be executed when >> >>"EXIT" is executed. >> >> >> >>No database even needs to be connected so it is not a database issue. >> >> >> >>------------------------ >> >>CLS >> >> >> >>CHOOSE vans + >> >>FROM + >> >>#LIST 'Safe Deposit,Box Inventory,Video Tapes,R> Prompt,Exit' + AT >> >>CENTER CENTER CAPTION 'Record Selection' >> >> >> >>IF vans = '[ESC]' OR vans = 'R> Prompt' THEN >> >> QUIT TO cleanup.cmd >> >>ENDIF >> >> >> >>IF vans = 'Exit' THEN >> >> EXIT >> >>ENDIF >> >> >> >>-- other conditions here >> >> >> >>IF vans = 'Safe Deposit' THEN >> >> QUIT TO safe.cmd >> >>ENDIF >> >> >> >>*(causes 2 GB to be written to the Swap file then deleted if the "EXIT" >> >>command above is executed.) >> >>QUIT TO main.cmd >> >> >> >>RETURN >> >> >> >>----------------------- >> >> >> >>Any thoughts? >> >> >> >>Thanks, >> >>Michael >> >> >> >> >> >> >> >>Michael Moser >> >>EXAQ Micro Services >> >>www.exaq.com >> >>Phone: 916-966-8313 >> >>Fax: 916-244-0582 >> >> >> >> >> >> >> > >> >____________________________________________________________________ >> >CAUTION - This message may contain privileged and confidential >> >information intended only for the use of the addressee named above. >> >If you are not the intended recipient of this message you are hereby >> >notified that any use, dissemination, distribution or reproduction of >> >this message is prohibited. If you have received this message in error >> >please notify Air New Zealand immediately. Any views expressed in this >> >message are those of the individual sender and may not necessarily >> >reflect the views of Air New Zealand. >> >_____________________________________________________________________ >> >For more information on the Air New Zealand Group, visit us online at >> >http://www.airnewzealand.com >> >_____________________________________________________________________ >> > >> > >> > >> ____________________________________________________________________ >> CAUTION - This message may contain privileged and confidential >> information intended only for the use of the addressee named above. >> If you are not the intended recipient of this message you are hereby >> notified that any use, dissemination, distribution or reproduction >> of this message is prohibited. If you have received this message in >> error please notify Air New Zealand immediately. Any views expressed >> in this message are those of the individual sender and may not >> necessarily reflect the views of Air New Zealand. >> _____________________________________________________________________ >> For more information on the Air New Zealand Group, visit us online >> at http://www.airnewzealand.com >> _____________________________________________________________________
