I think others have answered this, but I will try to explain a little more:

Let's do the easy one first:  The &vfile instead of .vfile because it is a
command you want to execute and not just a variable you want the value from
to use in an expression.

Ok, now changing var types inside of while loops gets more complicated.
While loops get optomized to run faster because after the first pass through
the loop, it makes some assumptions to optomize code and improve
performance.  The second reason is they have a tendancy to leak memory if
you are not carefule.  You might want to look at the whileopt setting too.
I normally run with whileopt off, but sometimes you can turn it on and get
better performance depending on what you are doing.  An example of wanting
to turn it on would be if you had a loop doing a bunch of mathmatical
calculations.  This type of loop will run faster w/ whileopt on.  Now a loop
doing a bunch of lookups from tables you will not see much diference with
whileopt.  If you turn whileopt on, you MUST declare all vars first or your
app will blow up, but will work fine in the debugger because the debugger
always has it off.  Even when whilopt is off, R:base still does some
optomization and makes some assumptions about your code.

The moral of the story is to declare all vars before your while loop and do
not change types or clear them in the loop.

Now we can get into my personal thougts on while loops, and this problems
varies depending on the version of R:base you are using.
The longer your loop (more code inside it), the higher the chances are that
you will have problems.  I think this problem gets better with every release
of R:base.
If I have a while loop that becomes problematic, I will change it into an if
statement and a goto.  I didn't say I would have gotten a good grade doing
this at school, but quite ofter it works better.  This problem also varies
with the OS you are using.

Troy


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dan
Champion
Sent: Thursday, July 10, 2003 11:01 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: RBw65.exe has caused an exception



Ok... seeing as how I have done just this.... can you explain why it is
wrong. (probably the answer to some of my little bugs I hadn't found)
Dan


At 07:23 AM 7/10/2003 -0600, you wrote:

>Changing the value of the variable inside the while loop is ok, but try to
>avoid defining and re defining vars in a while loop.  By redefining, I mean
>don't change the var type.
>
>This is the best way to do it:
>
>set var vfile text
>while ......
>set var vfile = whatever
>endwhile
>
>
>DON'T do this:
>
>while .........
>set var vfile text = whatever
>endwhile
>
>
>AND DON'T do this:
>
>while ...........
>set var vfile int = (25)
>set var vfile text
>set var vfile text = whatever
>endwhile
>
>I would also use &vfile in your load command instead of .vfile.
>
>Troy
>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of rich
>Jasinski
>Sent: Thursday, July 10, 2003 7:10 AM
>To: RBASE-L Mailing List
>Subject: [RBASE-L] - RE: RBw65.exe has caused an exception
>
>
>I have finally found the line of code that is causing it to crash, even in
>trace mode. I am doing a :
>load tablea from .vfile as ascii
>I redefine the vfile variable in a whileloop just before I do the load.
>Could this be the problem?
>
>rich
>----- Original Message -----
>From: "Ramsour Mike" <[EMAIL PROTECTED]>
>To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
>Sent: Thursday, July 10, 2003 8:12 AM
>Subject: [RBASE-L] - RE: RBw65.exe has caused an exception
>
>
> > Rich:
> >
> > I had a rash of problems like this several months back.  It was driving
me
> > crazy!  I made a number of changes and enhancements that ultimately
> > eliminated the problem.  R:Base is running smooth as butter now.
> >
> > I would suggest that you carefully inspect each R:Base script/program
that
> > is involved in this process.  In my instance I had a command file that
had
> > the notorious hanging continuation character.  A line of code ended with
a
> > plus sign (+) that was not needed.
> >
> > Use R:Code to check your programs.  Note that R:Code is not a compiler
and
> > it will not catch the hanging continuation problem but you may be
>surprised
> > to find some hard-to-find coding errors.
> >
> > I have also greatly reduced my use of temporary tables.  A comment was
>made
> > some time back to the effect that temporary tables do not handle indexes
> > well.  I have cleaned up my code considerably.  I create and type each
> > variable very explicitly and then I clear them once they're not needed.
> > Make sure you are not attempting to use a variable or redefining a
>variable
> > to an incompatible type depending on how it's being used.
> >
> > Review the rules for WHILE loops and using cursors if you use them.
> >
> > Beyond that make sure you have the latest service packs for all
software.
> > Service Pack 4 was just released for Windows 2000.
> >
> > Another thing that may have been causing me problems was a known
conflict
> > between Norton Antivirus and the Adobe Distiller software.  Here again
>make
> > sure you are using the latest versions/patches/fixes.  This goes both
for
> > the Norton product and the Adobe software.
> >
> > Others will probably chime in with other suggestions but I can tell you
>from
> > my own experience that I have eliminated nearly all R:Base crashes.
> > Probably 99% of the time it's a programming problem or a software issue
> > outside of R:Base.
> >
> > Hope that helps.
> >
> > Mike Ramsour
> > voice:  740-829-4340
> >
> > -----Original Message-----
> > From: rich Jasinski [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, July 10, 2003 7:00 AM
> > To: [EMAIL PROTECTED]
> > Subject: [RBASE-L] - RBw65.exe has caused an exception
> >
> >
> >
> >
> >
> >
> > I have a client that has the latest version of 6.5++. They are
>experiencing
> > a great increase in the number of time rbase crashes with the above
error.
> > When looking at the Dr Waqtson log it is always an access violation. The
> > machine is a new 1.7gz with 2 gig of memory running win2000
professional.
> > The problem seems to occur when a command file is selected off of a APP
>pull
> > down. The comand file starts executes a few lines of code then crashed.
>When
> > I trace the command file it runs without a problem.
> >
> > Any ideas?
> >
> > rich



Dan Champion
P.O. Box 223
Grandville, MI. 49428-0223
www.championsolutions.net

Reply via email to