![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Dunno if this has been posted here before, but I ran across a strange bug with the 'AL' variant of LOCATE() on uniData 7.2 which is illustrated in this uniBASIC program: CODES = CHANGE('A,7,7B,7',',',@AM) LIST = '' FOR I = 1 TO DCOUNT(CODES,@AM) * CODE = CODES<I * LOCATE(CODE,LIST,1;POS;'AL') ELSE LIST = INSERT(LIST,1,POS;CODE) * LOCATE(CODE,LIST,2;POS) ELSE * * FOR POS = 1 TO DCOUNT(LIST<2>,@VM) * * * IF CODE < LIST<2,POS> THEN EXIT * * NEXT POS * * LIST = INSERT(LIST,2,POS;CODE) * END NEXT I CRT CHANGE(CHANGE(LIST,@VM,';'),@AM,CHAR(10):CHAR(13)) The output of the program is this: 7;7B;A;7 * * <-- note the ending "7" ! 7;7B;A The first locate, with the 'AL' variant, produces the first list, with the '7' value repeated (in error) at the end. The second locate, with the subsequent FOR/NEXT loop, does the right thing. Anybody seen this before? Is there a tweak to uniBASIC that will fix the LOCATE() with the 'AL' variant, in the case that some of the values are numeric, some are alpha, and some are mixed? -- frosty |
#3
| |||
| |||
|
|
Dunno if this has been posted here before, but I ran across a strange bug with the 'AL' variant of LOCATE() on uniData 7.2 which is illustrated in this uniBASIC program: CODES = CHANGE('A,7,7B,7',',',@AM) LIST = '' FOR I = 1 TO DCOUNT(CODES,@AM) * CODE = CODES<I * LOCATE(CODE,LIST,1;POS;'AL') ELSE LIST = INSERT(LIST,1,POS;CODE) * LOCATE(CODE,LIST,2;POS) ELSE * * FOR POS = 1 TO DCOUNT(LIST<2>,@VM) * * * IF CODE < LIST<2,POS> THEN EXIT * * NEXT POS * * LIST = INSERT(LIST,2,POS;CODE) * END NEXT I CRT CHANGE(CHANGE(LIST,@VM,';'),@AM,CHAR(10):CHAR(13)) The output of the program is this: 7;7B;A;7 * * <-- note the ending "7" ! 7;7B;A The first locate, with the 'AL' variant, produces the first list, with the '7' value repeated (in error) at the end. The second locate, with the subsequent FOR/NEXT loop, does the right thing. Anybody seen this before? Is there a tweak to uniBASIC that will fix the LOCATE() with the 'AL' variant, in the case that some of the values are numeric, some are alpha, and some are mixed? -- frosty |
#4
| |||
| |||
|
|
I can replicate this on UD 7.1.6 on Windows if I turn UDT.OPTIONS 85 ON. The default is OFF. hth Colin Alfke Calgary Canada |
#5
| |||
| |||
|
|
Frosty, Output in Unidata 7.1.8: 7;7B;A 7;7B;A For both 'U' and "P' types. Version 7.2 bug? |
#6
| |||
| |||
|
|
Is there a tweak to uniBASIC that will fix the LOCATE() with the 'AL' variant, in the case that some of the values are numeric, some are alpha, and some are mixed? |
#7
| |||
| |||
|
|
"Colin" wrote in message news:fc28447a-4cd1-4d0e-9b8c-add80ccd5086 (AT) q2g2000vbk (DOT) googlegroups.com... I can replicate this on UD 7.1.6 on Windows if I turn UDT.OPTIONS 85 ON. The default is OFF. hth Colin Alfke Calgary Canada Thanks, Colin, that's exactly my problem. Turns out we turn option 85 ON at LOGIN, to fix some _other_ problem with LOCATE(). -- frosty |
![]() |
| Thread Tools | |
| Display Modes | |
| |