function myinteger returns integer (str as char):
define variable str2 as character no-undo.
define variable i as integer no-undo.
str= trim(str).
do i = 1 to length(str):
str2 = substring(str,i,1).
if str2 = '-' then do:
if i <> 1 then
return ?.
else
next.
end.
if lookup(str2, '0,1,2,3,4,5,6,7,8,9,0') = 0 then
return ?.
end.
return integer(str).
end function.