Here's a Basic routine I use in UD:

SUBROUTINE QUICKSORT(ARRAY)
*    ** Quick Sort the elements of a dynamic array
     EQU AM TO CHAR(254)
     VALUES = DCOUNT(ARRAY,AM)
     IF VALUES <= 1 THEN RETURN
     PIVOT = ARRAY<1>;    ** First element
     HIGHSTRING = '';     ** list of elements > pivot
     LOWSTRING = '';      ** list of elements < pivot
     FOR X = 2 TO VALUES
        ELEMENT = ARRAY<X>
        IF ELEMENT > PIVOT THEN
           HIGHSTRING<-1> = ELEMENT
        END ELSE
           LOWSTRING<-1> = ELEMENT
        END
     NEXT X
     CALL QUICKSORT(LOWSTRING)
     CALL QUICKSORT(HIGHSTRING)
     ARRAY = ""
     IF LOWSTRING # "" THEN ARRAY<-1> = LOWSTRING
     IF PIVOT # "" THEN ARRAY<-1> = PIVOT
     IF HIGHSTRING # "" THEN ARRAY<-1> = HIGHSTRING
     RETURN

===========================================================
Norman Morgan <> [EMAIL PROTECTED] <> http://www.brake.com
===========================================================
You are in a maze of twisty subroutines, all alike!
===========================================================

 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Baker Hughes
> Sent: Tuesday, July 22, 2008 9: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/

Reply via email to