Guidance Forums / Reginald Rexx / Bug: SORT DOWN

Search 搜索
Home Home

Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Bug: SORT DOWN
Posted by: gabeh 2007-10-09 01:20:52

Could you look into this?

I encountered a problem with SORT DOWN.

Problem: After executing "SORT DOWN", it seems missing one entry and enconteres a "no value" condition.
But if "SORT DOWN" is following an asending order sort, as commented out below, it works as expected.

A test script is as follows:

/* Test Sort Descending Order */
do s = 1 to 10
  d = /*100 +*/ s
  sdata.s = d

/*say "Testing Ascending Order"
SORT sdata. A

send = sdata.0

do s = 1 to send
  say sdata.s

say "Testing Descending Order"
SORT DOWN sdata. A

send = sdata.0

do s = 1 to send
  say sdata.s
Message2. The docs indicate that you don't need to set sdata.0
Posted by: Michael S 2007-10-09 01:38:13
but try setting sdata.0 to 10 before the sort and you'll see it works.
Message3. Yes, it works. but...
Posted by: gabeh 2007-10-09 05:39:51
should it work without setting sdata.0? It works file with just "SORT" asending order.

Anyway, thank you. I will change my script per your suggestion.
Message4. Have to be honest,
Posted by: Michael S 2007-10-09 14:55:24
I never have a stem variable without the .0 variable as well. From my point of view, I can't imagine a scenario where I'd be able to code WITHOUT knowing the value in sdata.0. Almost any time you use a stem, you end up with something similar to

DO i = 1 TO sdata.0
 code code
Message5. It should work without the .0 variable
Posted by: DougA 2007-10-09 23:12:48
From the doc file:

Note: All tails of the stem are sorted. It is not possible to exclude any tails from being sorted. A tail with the name StemName.0 is ignored in the sort, and its value will be overwritten (with the "sort count") after the SORT.

From my tests:

A normal sort does work without setting the .0 entry, but the DOWN version loses the last sorted entry unless the .0 is preinitialized to anything.

Changing the subject some, but leaving the 'A' off of the sort command, still runs, but produces a mixed up result.
Message6. Bump
Posted by: Michael S 2010-11-08 22:25:23
It would be nice if this bug was fixed. Basically, sort down doesn't seem to be setting the value for  stem.1
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
© Sun 2024-5-19  Guidance Laboratory Inc. Hits:0