Hi Chuck, Glad to be of assistance! I've always used this similar method for all my sorted datasets, but never had one that was just a pure sort (usually find and add-to, or not find and insert) so didn't have time to ponder the THEN. Always inserting is *of course* necessary.
Amazing how short and sweet the LOCATE/INSERT does sorts, isn't it? I can remember when I first started back in the 70's doing a sort in assembler for the IBM 370 as a class assignment. It was like a whole box of punch cards.....gaaaaa!!!!! See ya on the list! *=aee=* Allen E. Elwood Senior Programmer Analyst Curnayn and Associates Direct (818) 361-5251 Fax (818) 361-5251 Cell (818) 359-8162 Home (818) 361-7217 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Chuck Mongiovi Sent: Tuesday, July 27, 2004 13:14 To: [EMAIL PROTECTED] Subject: RE: [U2] merge sort ok .. i've finally gotten a little bit of time to play with this again and I was *SHOCKED* at how fast it is .. no doubt it's because the OS handles the LOCATE much faster than I could in BASIC .. the only changes I had to make to the program were to use 0,0 instead of 1,1 as VMC/SVMC in the LOCATE, do only 1 large EXTRACT (via LINE=REC<J>) and 1 small EXTRACT (LOOK.FOR=LINE<1,5>) and *ALWAYS* do the INSERTS: SORT.DATA = "" SORT.INDEX = "" SORT.COUNT = DCOUNT(REC,@AM) * FOR J = 1 TO SORT.COUNT LINE = REC<J> LOOK.FOR = LINE<1,5> LOCATE LOOK.FOR IN SORT.INDEX BY 'DR' SETTING FOUND ELSE NULL SORT.INDEX = INSERT(SORT.INDEX , FOUND, 0, 0, LOOK.FOR) SORT.DATA = INSERT(SORT.DATA , FOUND, 0, 0, LINE) NEXT J Thanks again .. -CHuck ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/