-----Original Message-----
From: John Solie
> I'm wondering why y'all are using a ...MATCHES "0N"...
> Usually, I'll use the NUM() function. The code snippet
> in one of the first messages in this thread would be:
>
> BEGIN CASE
> CASE NUM(ANS) AND ANS > 0
> <more code here>
>
> Or is NUM() something that lives only in UniData?
John,
Because it is legacy code. It's what is.
& until this morning I didn't know what the problem was.
NUM() is avaible on UV (& all MVs I know of). It would work fine & I
generally use it.
UV (10.0, anyway) has the feature/bug where leading and trailing spaces
are OK
NUM( ANS ) seems to come up false at str(1,309), which is where I fould
EXTRACT() failed, too. But at least NUM() does not yield a runtime
error:
>CT CDS.BP JOHN
JOHN
0001 I = 0
0002 LOOP
0003 ANS = STR( '1', I )
0004 WHILE NUM( ANS )
0005 I+= 1
0006 REPEAT
0007 CRT I
>
>RUN CDS.BP JOHN
309
>
______________
In my case the solution is probably going to be to replace
(ANS MATCHES '0N' & ANS>0)
with
(ANS MATCHES '1-2N')
That's a tighter edit than NUM(ANS).
This is supposed to be a menu pick, for Pete's sake.
We can jolly well limit our menus to 99 options.
072: BEGIN CASE
073: CASE ANS MATCHES '1-2N' <--- thank-you very much
074: IF MITM<5,ANS>#"" THEN
Speaking of NUM(), UV 10.0 has the feature/bug of allowing leading and
trailing spaces:
>CT CDS.BP NUMTEST
NUMTEST
0001 X = ''; X<12> = 'ABC'
0002 CRT NUM( ' 12' ), X< ' 12' >
0003 CRT NUM( '12 ' ), X< '12 ' >
0004 CRT NUM( '1 2' ), X< '1 2' >
>
>RUN CDS.BP NUMTEST
1 ABC
1 ABC
0 Program "NUMTEST": Line 4, Nonnumeric data when numeric
required. Zero used.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/