Subject Re: RECNO()
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Thu, 7 Feb 2019 13:24:01 -0800
Newsgroups dbase.getting-started

On 2/7/2019 12:29 PM, Mervyn Bick wrote:
> On 2019-02-07 10:08 PM, Ken R. wrote:
>> I'm working on a older program that has the following line:
>>
>> COPY RECNO() TO TEMP
>>
>> in a loop through about 10,000 records.  By the end of that loop the
>> PlusRun memory requirement has grown to over 10 times its memory
>> requirements and machine performance slows to a crawl. I have narrowed
>> the problem down to that line. So I'd like to replace that line <COPY
>> RECNO() TO TEMP> >with something simple and straightforward.  Any
>> quick advice would be much appreciated.  Thanks!!
>>   Ken R.
>>
>
>
> It's a LONG time since I used XDML but that syntax looks wrong.  It
> certainly doesn't work in dBASE 12.3.1.  It gives the error "Unallowed
> phrase/keyword in command: recno() to temp"
>
> If you want to copy the entire table open in the workarea to TEMP then
>
> COPY TO TEMP
>
> If you want to copy selected records then the syntax would be something
> like
>
> COPY TO TEMP FOR RECNO() > 5 AND RECNO() <10
>

As Mervyn points out, unless there's a reason to put that into a loop,
it's probably going to be SERIOUSLY slow after a while ... the loop is
processing the records one at a time. If a command like what Mervyn
shows will work for you, it will undoubtedly be faster and use less memory.

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm