Jeff,

Can you compare the speed of your C sorting program with this one?  It's
untested code...

FUNCTION SortArray(InArray, AllowDups, SortBy)
*
OutArray   = Remove(InArray, MoreItems)
ArrayDelim = @RM:@AM:@VM:@SM:@TM[MoreItems, 1]
If SortBy = "" then SortBy = "AL"
*
While MoreItems Do
  Item = Remove(InArray, MoreItems)
  Locate Item in OutArray<1> by SortBy setting Pos then
     If AllowDups then Ins Item before OutArray<Pos>
  End else
     Ins Item before OutArray<Pos>
  End
Repeat
*
Swap @AM with ArrayDelim in OutArray
Return OutArray

Can you share your 'C' program?  Maybe IBM can add it to U2 products as
SORT() Function.

Thanks,
David A. Green
www.dagconsulting.com
(480) 813-1725


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeff Marcos
Sent: Tuesday, July 22, 2008 4:35 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Basic SORT() Function not avail in UniVerse?

We had the same issue back in the 90's. So a clever guy (Ed) that worked
with us wrote a small C program (on Unix) to do the sort. This also
included controlling/dependants fields. Any universe program could call
it, passing in the variables and returned the items sorted.

Speed is incredible. To this day it's still used and blitzes any
universe program methods in sorting large arrays. 

Regards,
Jeff Marcos

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Allen E. Elwood
Sent: Wednesday, 23 July 2008 6:59 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Basic SORT() Function not avail in UniVerse?

Hey, and don't forget to do a speed test.  You know, because LOCATE is
coded
as part of the OS it just *might* be faster than bubble or speed sort
options.

In fact, this was a topic on this list about 3 or 4 years ago and
someone
doing the speed test concluded LOCATE was in fact faster.

And no I don't remember who it was, or have a link to the thread (sorry)

:-)

Allen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Israel, John R.
Sent: Tuesday, July 22, 2008 10:26
To: 'u2-users@listserver.u2ug.org'
Subject: RE: [U2] Basic SORT() Function not avail in UniVerse?


Note that if the array is big, you would get much better performance by
loading it into a DIM array, so the sort of sort below, then put the
results
back into a dynamic array.

Dynamic arrays are much easier to use, but when used wisely, dimensioned
arrays can be MUCH faster.  This is true for any application, esp.
looping
through multi-values.

John Israel


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of DAVID WADEMAN
Sent: Tuesday, July 22, 2008 1:00 PM
To: u2-users@listserver.u2ug.org
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/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

The information contained in this email and any attached files are strictly
private and confidential. This email should be read by the intended
addressee
only.  If the recipient of this message is not the intended addressee,
please
call Corporate Express Australia Limited on +61 2 9335 0555 or Corporate
Express
New Zealand Limited on +64 9 279 2555 and promptly delete this email and any
attachments.  The intended recipient of this email may only use, reproduce,
disclose or distribute the information contained in this email and any
attached
files with Corporate Express' permission. If you are not the intended
addressee,
you are strictly prohibited from using, reproducing, disclosing or
distributing
the information contained in this email and any attached files.  Corporate
Express advises that this email and any attached files should be scanned to
detect viruses. Corporate Express accepts no liability for loss or damage
(whether caused by negligence or not) resulting from the use of any attached
files.
-------
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