dbTalk Databases Forums  

Sorting arrays

comp.databases.pick comp.databases.pick


Discuss Sorting arrays in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tracy Raines
 
Posts: n/a

Default Sorting arrays - 05-04-2006 , 01:34 PM






I don't know if I have stumbled on a bug, or just don't understand how
this is supposed to work. We are running D3 7.3 Linux. I have this
small program:

*
VM = CHAR(253)
*
A = 4:VM:8:VM:27:VM:-33:VM:12:VM:56:VM:14:VM:87:VM:0:VM:45
B = SORT(A,1;'DR')
FOR X = 1 TO 10
PRINT B<1,X>
NEXT X
*
STOP

When ran, this is the output:

:RUN BP.THR CHECK.DR
0
87
56
45
27
14
12
8
4
-33

Since I am doing a descending right sort, why is the 0 at the top of
the list?

Is this a bug, or by design?


Reply With Quote
  #2  
Old   
Scott Ballinger
 
Posts: n/a

Default Re: Sorting arrays - 05-04-2006 , 02:26 PM






Looks like a bug to me. I get the same results (misplaced "0" element)
whether am or vm-delimited, whether sorting ascending or descending, and
whether flashed or not. (d3 7.4.2 rhes4).

/Scott Ballinger
Pareto Corporation
Edmonds WA USA
206 713 6006

Tracy Raines wrote:
Quote:
I don't know if I have stumbled on a bug, or just don't understand how
this is supposed to work. We are running D3 7.3 Linux. I have this
small program:

*
VM = CHAR(253)
*
A = 4:VM:8:VM:27:VM:-33:VM:12:VM:56:VM:14:VM:87:VM:0:VM:45
B = SORT(A,1;'DR')
FOR X = 1 TO 10
PRINT B<1,X
NEXT X
*
STOP

When ran, this is the output:

:RUN BP.THR CHECK.DR
0
87
56
45
27
14
12
8
4
-33

Since I am doing a descending right sort, why is the 0 at the top of
the list?

Is this a bug, or by design?


Reply With Quote
  #3  
Old   
Mark Brown
 
Posts: n/a

Default Re: Sorting arrays - 05-04-2006 , 02:36 PM



The SORT command has two flavors: standard top-down, left-to-right and the
new (x,ac,cv,seq) method you are using. This second method however, is
merely doing a locate/replace to re-arrange the specified attribute {and
value}.

It still uses an alpha sort, just like the "DR" does in LOCATE. I tried
DRS, which is supposed to support numeric sequence, but it didn't make a
difference.

Mark Brown

"Tracy Raines" <liveblues (AT) gmail (DOT) com> wrote

Quote:
I don't know if I have stumbled on a bug, or just don't understand how
this is supposed to work. We are running D3 7.3 Linux. I have this
small program:

*
VM = CHAR(253)
*
A = 4:VM:8:VM:27:VM:-33:VM:12:VM:56:VM:14:VM:87:VM:0:VM:45
B = SORT(A,1;'DR')
FOR X = 1 TO 10
PRINT B<1,X
NEXT X
*
STOP

When ran, this is the output:

:RUN BP.THR CHECK.DR
0
87
56
45
27
14
12
8
4
-33

Since I am doing a descending right sort, why is the 0 at the top of
the list?

Is this a bug, or by design?




Reply With Quote
  #4  
Old   
Dave Mitchell
 
Posts: n/a

Default Re: Sorting arrays - 05-04-2006 , 09:52 PM



--- Ooops - sorry Tracy - I meant to post this to the group, no e-mail it to
you personally.....

Just FYI, I tried running this on UniVerse (had to change the SORT function
to a few lines of code to loop through A and insert into B using a LOCATE by
'DR'), and it worked fine.

"Tracy Raines" <liveblues (AT) gmail (DOT) com> wrote

Quote:
I don't know if I have stumbled on a bug, or just don't understand how
this is supposed to work. We are running D3 7.3 Linux. I have this
small program:

*
VM = CHAR(253)
*
A = 4:VM:8:VM:27:VM:-33:VM:12:VM:56:VM:14:VM:87:VM:0:VM:45
B = SORT(A,1;'DR')
FOR X = 1 TO 10
PRINT B<1,X
NEXT X
*
STOP

When ran, this is the output:

:RUN BP.THR CHECK.DR
0
87
56
45
27
14
12
8
4
-33

Since I am doing a descending right sort, why is the 0 at the top of
the list?

Is this a bug, or by design?




Reply With Quote
  #5  
Old   
Tracy Raines
 
Posts: n/a

Default Re: Sorting arrays - 05-12-2006 , 08:39 AM



Good news! At the time I posted this, I also posted it on the Raining
Data support forum. Raining Data has confirmed that it is a bug and
has opened an action item for it. They will also be adding AN and DN
codes for sorting numeric values.


Reply With Quote
  #6  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Sorting arrays - 05-12-2006 , 01:05 PM



"Tracy Raines" <liveblues (AT) gmail (DOT) com> wrote:
Quote:
Good news! At the time I posted this, I also posted it on the Raining
Data support forum. Raining Data has confirmed that it is a bug and
has opened an action item for it. They will also be adding AN and DN
codes for sorting numeric values.
Just to clarify, I requested an enhancement to equate the sequencing
codes AN=ARS and DN=DRS because the AN/DN codes are valid in R91 and
related platforms. There is no guarantee that the codes will be
added, probably because the chances are really low that anyone would
be using them. Right now anything that is invalid, as AN/DN are now,
is reset to Left justified, or AL/DL. This means a default R91
migration would take right justified sorts and make them left
justified, which I thought was nasty enough to requested an update.

The sorting issues are already fixed in an upcoming release, and the
ARS/DRS sort sequences for Locate are also documented in an upcoming
D3 Ref.

HTH
T


Reply With Quote
  #7  
Old   
Tracy Raines
 
Posts: n/a

Default Re: Sorting arrays - 05-12-2006 , 01:43 PM



Thanks for the clarification Tony.


Reply With Quote
  #8  
Old   
GRDB2001
 
Posts: n/a

Default Re: Sorting arrays - 05-15-2006 , 10:32 PM



I know in UniData, that if you do not initialize the dynamic array that you
are storing your sorted information, you will get a null value or a zero
value in the first position of your array.

Just adding my $0.00000002 worth! (USD)

Grant
"Tracy Raines" <liveblues (AT) gmail (DOT) com> wrote

Quote:
I don't know if I have stumbled on a bug, or just don't understand how
this is supposed to work. We are running D3 7.3 Linux. I have this
small program:

*
VM = CHAR(253)
*
A = 4:VM:8:VM:27:VM:-33:VM:12:VM:56:VM:14:VM:87:VM:0:VM:45
B = SORT(A,1;'DR')
FOR X = 1 TO 10
PRINT B<1,X
NEXT X
*
STOP

When ran, this is the output:

:RUN BP.THR CHECK.DR
0
87
56
45
27
14
12
8
4
-33

Since I am doing a descending right sort, why is the 0 at the top of
the list?

Is this a bug, or by design?




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.