All:

Here's a (hopefully) clean test routine for the SLOCP wierdness that
Dennis and I thrashed around with yesterday. Can't help but think I'm
missing something really basic. If not, what's going on?

Input values 1-10 produce expected results. Input values > 10 produce
anomaly. LAST parameter values (three tests provided) should produce
'10', instead go wandering, lost in space. Run the test repeatedly to
watch the results change.

Dennis is in v7.6. I'm in TV-8 8.0.24.31116. I've cleared variables
explicitly at the end of the routine so this shouldn't mess with your
own environments.

Cheers,
bruce chitiea
safesectors inc
*****************

-- test_slocp.rmd
-- 2010-1130
-- test SLOCP function wierdness

SET VAR vsearchedstring NOTE = ' 1 2 3 4 5 6 7 8 9 10'
SET VAR vtarget TEXT = (CHAR(32))
SET VAR vinput TEXT

DIALOG 'Enter a number' vinput vendkey 1 +
CAPTION 'Input 1-10 works; 10+ is Whack'

SET VAR voccurrence INT = (INT(.vinput))

SET VAR vtargetpos INT = (SLOCP(.vsearchedstring,.vtarget,.voccurrence))
WRITE '   Target No:' .voccurrence '   String Position:' .vtargetpos
SET VAR vtargetpos = NULL

SET VAR vtargetpos INT = (SLOCP(.vSearchedString,.vTarget,-1))
WRITE 'Target LAST1:' .vtargetpos
SET VAR vtargetpos = NULL

SET VAR vtargetpos INT = (SLOCP(.vSearchedString,.vTarget,-1))
WRITE 'Target LAST2:' .vtargetpos
SET VAR vtargetpos = NULL

SET VAR vtargetpos INT = (SLOCP(.vSearchedString,.vTarget,-1))
WRITE 'Target LAST3:' .vtargetpos
SET VAR vtargetpos = NULL

CLEAR VAR vsearchedstring
CLEAR VAR vtarget
CLEAR VAR vtargetpos
CLEAR VAR vinput

RETURN


Reply via email to