Re: Checking datatype of CHAR variable in 4GL
Posted in 1998
Nice try Jack. That's what I've been doing for a long time, until I discovered that, starting from 4gl 4.13, non fatal errors where added to the error log all the same :-( Had to go down to c and resort to strtol... Ciao, Marco _______________________________________________________________________________ Marco Greco, Catania, Italy marcog@linux.ctonline.it rem radioterapia +39 95 447828 fax 446558 Informix faq http://www.iiug.org/techinfo/faq/informix.htm 4glworks http://www.ctonline.it/~marcog Informix on Linux http://www.ctonline.it/~marcog/ifmxlinux.htm jparker@epsilon.com wrote: > > I wrote one not too long ago: > > FUNCTION DUMMY > > WHENEVER ANY ERROR CONTINUE > > END FUNCTION > > FUNCTION not_an_int(incoming) > > DEFINE incoming INTEGER > > RETURN status > > END FUNCTION > > FUNCTION DUMMY2 > > WHENEVER ERROR .... > > END FUNCTION > > Then merely... > > IF not_an_int(char_var) THEN ........ > > Note - I wouldn't swear to the WHENEVER syntax - I may have that slightly > off. Of course I don't have the function handy... > > The trick is in to getting the compiler to not check status for your > conversion. Passing the char variable to a function which expects an int > implies a conversion and status gets set if it fails. > > cheers > j.