oops

> i=i from table1 *(the autonum key col)
> i=0
> comp ifrom as min i from table1
> comp ito as max i from table1
> LABEL START
> i=i from table1 where i=.ifrom
>  if i is not null then
>    *(do your action on table1 here)
>  endi
> ifrom=.ifrom+1
>  if ifrom>.ito then
>   goto end
>  endi
> goto start
> LABEL END
>
> That little code will speed up to the moon and back without a hitch.
>
>
>
> On Tue, Sep 11, 2012 at 3:24 PM, <[email protected]> wrote:
>
>> Remember a while ago I was asking for ideas about a gigantic cursor that
>> would error out at some point.   Probably within a month I'll need to start
>> work on this.
>>
>> The most popular suggestion was to replace the cursor loops with a bunch
>> of "goto".  I've never used Goto for big processes like this, just simple
>> program movements.   My first cursor (the biggest one) is through a table
>> with over 100,000 rows, but the cursor has a where clause so it steps
>> through about half of them.   There is an autonumbered column in the
>> table.
>>
>> So trying to avoid a "while" loop of any kind, how could I structure the
>> "goto" code?   Do I grab a minimum/maximum autonumber that my cusor would
>> have gone through, increment it by one to see if there's anything to
>> process (in which case there will be thousands of autonumbers that I will
>> increment but not process; I guess that's okay as long as the program does
>> work).
>>
>> My other thought is that I could make a permanent working table and load
>> it with the rows that I would have cursored through, put a fresh autonumber
>> column on that table and then step through that table.   There are other
>> cursors to other tables based on these rows, so I have to also think of
>> ways to convert those into non-cursors (or maybe those will be okay as long
>> as I remove the upper level one).
>>
>> Suggestions again?
>>
>> Karen
>>
>>
>>
>
>
> --
> William Stacy, O.D.
>
> Please visit my website by clicking on :
>
> http://www.folsomeye.net
>
>
>
>


-- 
William Stacy, O.D.

Please visit my website by clicking on :

http://www.folsomeye.net

Reply via email to