Before we had the SORT function, I wrote out the variable to a directory and
used the *nix sort command.  I don't have the original program, but I
re-created it here as best I could.  I remember the program as being a lot
more complicated then this, but here it is anyway.

SUBROUTINE SORT.STUFF(BIG.ARRAY,SORTED.ARRAY)
*
* Must have a temporary dir-type file
*
OPEN 'TEMPDIR' TO F.TEMPDIR ELSE STOP 201,'TEMPDIR'
TEMP.KEY = @USERNO:'*':@LEVEL
TEMP.PATH = FILEINFO(F.TEMPDIR,2):'/':TEMP.KEY
*
WRITE BIG.ARRAY ON F.TEMPDIR,TEMP.KEY
*
CMD = '!sort -o ':TEMP.PATH:' ':TEMP.PATH
EXECUTE CMD CAPTURING OUTPUT RETURNING ERROR.MESSAGE
*
READ SORTED.ARRAY FROM F.TEMPDIR,TEMP.KEY THEN
   DELETE F.TEMPDIR,TEMP.KEY
END ELSE
   PRINT;PRINT "Didn't work!"
END
RETURN

I only tested this once, it sorted a 1,000,000 line array in a couple of
seconds.

hth

----- Original Message -----
From: "Baker Hughes" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, July 22, 2008 10:50 AM
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/

[demime 1.01d removed an attachment of type application/pgp-signature which had 
a name of PGP.sig]
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to