Some results looks strange.
nulldata 1
list znull = null
isznull = exists(znull)
nznull = nelem(znull)
print isznull nznull
(ii) inside a function
function void listtestfun (scalar x, list z[null])
isz = exists(z)
nz = nelem(z)
print isz nz
end function
listtestfun(1)
We have
isznull = 1.0000000
nznull = 0.0000000
and
isz = 1.0000000
nz = 0.0000000
as expected
2) with strings
(i) in a script
string snull = null
issnull = exists(snull)
nsnull = strlen(snull)
print issnull nsnull
The behavior is the same as for lists
and is as expected to be
Also,
emptycheck = snull==""
print emptycheck
We see that 'string snull = null'
actually creates the "" string
(ii) inside a function
function void strtestfun (scalar x, string s[null])
iss = exists(s)
ns = strlen(s)
print iss ns
end function
strtestfun(1,"oleh")
OK!
strtestfun(1)
we have
The symbol 's' is undefined
*** error in function strtestfun, line 2
It seems now the problem is not
with exists() but is like this:
a function does not defines a string
variable in contrast as it does with
default null lists
3) catch string
function void testfun3 (scalar x, string s[null])
catch string s
err = $error
print err
end function
testfun3(1)
testfun3(1,"a")
Please, explain why we have "0" in the first
case and "2" in the second
Oleh
P.S.
I have tried to do something with formatting
but I have nowhere to check.
Please, inform me