Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / Bug in SORT ?

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Bug in SORT ?
#11893
Posted by: Michael S 2007-09-23 11:09:08
Ru the following code

temp.0 = 9
temp.1 = 'hello      09/03/2007-10:00'
temp.2 = 'hellohello 12/03/2007-11:00'
temp.3 = 'adam       12/04/2007-12:00'
temp.4 = 'eve        12/03/2007-10:00'
temp.5 = 'stockholm  12/03/2005-10:23'
temp.6 = 'london     28/05/2007-12:32'
temp.7 = 'me         12/03/2007-12:12'
temp.8 = 'yes        12/03/2007-12:12'
temp.9 = 'no         12/03/2007-12:12'

SORT temp. 18 a +4 15 b +2 12 c +2

DO i = 1 TO temp.0
	SAY 'temp.'i' = 'temp.i
END

SAY '*****************************'
temp.0 = 9
temp.1 = 'hello      09/03/2007-10:00'
temp.2 = 'hellohello 12/03/2007-11:00'
temp.3 = 'adam       12/04/2007-12:00'
temp.4 = 'eve        12/03/2007-10:00'
temp.5 = 'stockholm  12/03/2005-10:23'
temp.6 = 'london     28/05/2007-12:32'
temp.7 = 'me         12/03/2007-12:12'
temp.8 = 'yes        12/03/2007-12:12'
temp.9 = 'no         12/03/2007-12:12'

off1 = 18 ; off2 = 15 ; off3 = 12
SORT temp. (off1) a +4 (off2) b +2 (off3) c +2

DO i = 1 TO temp.0
	SAY 'temp.'i' = 'temp.i
END

SAY '*****************************'

The idea behind it is to sort the dates on yyyy, mm and dd. As can be seen, the only difference between the two variations is that one contains variables as offsets rather than hard-coded.
Message2.
#11927
Posted by: DougA 2007-10-02 00:09:14
unless i missed it, i couldn't find any reference to using an offset value in paren's
only string to parse on.  Both the sort & parse.
so maybe the sort is using the string '18' to parse the record on, causing strange results.

I would use:
SORT temp. . c '/' b '/' a '-'
for this example
Doug
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-4-14  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0