>I am writing a function which takes any data type as the parameter.
>
>Now in that function I have to check what is that parameter data type, do some manipulation and return the data in the same data type as passed.
>
>
>eg :
>
You might want to use a case statement here.
>Funct typeofvar
>param myvar
>
In this case below type() will return 'C' because you are passing it to STR() before it is passed to TYPE(). To get the actual data type use TYPE('myvar'). ie.
do case
case type('myvar') = 'N'
DO SOME ACTION
set return value
case type('myvar') = 'C'
DO SOME OTHER ACTION
set return value
endcase
return returnvalue
>if type(str(myvar)) = 'N' then
> ? 'numeric'
> return type(myvar)
>else
>if type(mvar) ='C' then
> ? 'charecter'
> return type(myvar)
>endif
>endif
>
>return
>
>**************
>**Main Prog
>
>=myfun('12')
>=myfun(12)
>******* end of prog
>
> the main problem lies with type of data passed
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only