Sorting an array

Richard D. Williams richard at appgrp.net
Wed Jun 1 11:03:57 PDT 2016


On 5/19/2016 2:00 PM, Kenneth Brody via Filepro-list wrote:
> On 5/18/2016 12:15 PM, Richard Kreiss via Filepro-list wrote:
> > I would like to be able to sort a 20 element array.
> >
> > Any suggestion as to how best to do this on a Windows machine?
>
> After all the discussion about overhead of external tools, I think a 
> lot of this boils down to how often is this sort going to be done.
>
> There's a world of difference in sorting 20 items once, prior to 
> running a million-record report, and once per record on a 
> million-record report.
>
Wow. I read all the emails in this thread and frankly, it was a waste of 
time.
As usual, Mark had way too much to say that never addressed the problem.
Again, Jose was his target.

In the end, Jose was right.
The simplest solution is to create some temp file that could be used for 
any number of elements in an array.

If you have a simple one or two data sort, write out the original 
element number, data one, and data two into this temp file.
Make sure there is an index build on data one and data two in the temp file.
After you have finished writing to this temp file, read the data back 
into a new array by that index.
You can use the original element number to get the rest of the data from 
the original array.

Now replace the data elements in the original array wit the new array 
and clear the new array and clear the temp file.
I often use the user's "TTY"  (linux) to make that instance unique.

Done!

Richard D. Williams






More information about the Filepro-list mailing list