[comp.lang.icon] Sorting index files

TENAGLIA@mis.mcw.edu (Chris Tenaglia - 257-8765) (06/06/91)

Regarding:	Sorting index files

> Dave Talmage inquired about sorting files that are too large to
> fit in memory.   I had the same problem in my indexing program
> for ``TeX for the Impatient''.  My solution was simple: two Icon
> programs and a sort in between, using the sort program that comes
> with your system.  This solution works equally well for Unix and
> DOS, although the standard DOS sorting program is probably not
> satisfactory; you'll have to shop around for a better one.  You
> can also do it with a single Icon program and the `system'
> function, or maybe even more elegantly with `system' and piped
> files under Unix.  But the two-program solution ain't that bad.
>>..more.. 
> Paul Abrahams
> Abrahams@mts.cc.wayne.edu
 
I also have a report generator with the same problem. It loads, sorts,
outputs. Somewhere between 2000 and 5000 items is the limit of icon
sort() {under VMS} so once the list is loaded I test it's size. If
greater than the limit, I write it to a temporary file, sort with
             system("sort/key=(pos:5,size:12,ascending) file.tmp")
reload the file, output the report and cleanup temp files.

Although there are sometimes when the list goes to 20,000 to 50,000 items
and I can't even fit it. So I have a passed parameter (-file) when I know this
will happen to run everything with temp files. VMS, unlike unix does not
have piping (who | sort | mail tenaglia).

Chris Tenaglia (System Manager) | Medical College of Wisconsin
8701 W. Watertown Plank Rd.     | Milwaukee, WI 53226
(414)257-8765                   | tenaglia@mis.mcw.edu, mcwmis!tenaglia