I can see that there can be better sorting methods out there, and possible faster. I see some places that uses c sort and locate methods for uses 10000+ records and using bubble method could be fatal to the system. At most we used this subroutine couple times a year for certain applications and if that for under 1000 records. At times, we just used BY @ID or @I-TYPE for sorting.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MAJ Programming Sent: Friday, July 25, 2008 10:04 AM To: [email protected] Subject: Re: [U2] Basic SORT() Function not avail in UniVerse? Given my age, I've used many manual sort methods (including bubble) years and years ago. Ever since I could LOCATE with the optional sorting parameter, I've never put a bubble sort in MV programs. VB and QB yes. MV, No. My 2 cents. Mark Johnson ----- Original Message ----- From: "DAVID WADEMAN" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, July 22, 2008 12:59 PM Subject: RE: [U2] Basic SORT() Function not avail in UniVerse? > This is a UniData subroutine, but should work .... > > SUBROUTINE B42.SORT.ARRAY(SORTED,ARRAY) > * Bubble sort the elements of a dynamic array > * Created by: David Wademan > * Creation Date: 01/05/05 > SORTED="" > VALUES = DCOUNT(ARRAY,@VM) > LOOP > CHANGES = 0 > FOR X = 2 TO VALUES > * For each adjacent pair > ELEMENT1 = ARRAY<1,X-1> > ELEMENT2 = ARRAY<1,X> > > IF ELEMENT2 < ELEMENT1 THEN > * Swap if pair out of sequence > ARRAY<1,X> = ELEMENT1 > ARRAY<1,X-1> = ELEMENT2 > CHANGES = 1 > END > NEXT X > WHILE CHANGES DO REPEAT > SORTED=ARRAY > RETURN > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Baker Hughes > Sent: Tuesday, July 22, 2008 10:51 AM > To: '[email protected]' > Subject: [U2] Basic SORT() Function not avail in UniVerse? > > Hey, > > I'm needing to SORT a dynamic array and apparently UniVerse doesn't have > this > Function. > > Other MV implementations have this, such as D3 - "The sort() function > sorts an > attribute or value mark delimited str.exp in ascending order." [from > ePick] > > There was also a user exit u1072 that did the same thing. > > Does anyone have a work around or fast path to same thing .... maybe I'm > missing something but can't see this in UV docs. > > -Baker > ------- > 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/ ------- 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/
