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: <u2-users@listserver.u2ug.org>
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: 'u2-users@listserver.u2ug.org'
> 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
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to