Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Mike Aubury — — source: Informix-list mailing list archive (1991-1998)
In article <39bniu$kci@emory.mathcs.emory.edu>
kestnb!mdk@uunet.uu.net "Michael Kastler" writes:
> Hi,
>
> I'm trying to take user inputted string data in Informix 4GL and use
> parts of it in an integer variable.
>
> Unfortunately, if the user does not enter a number in the area that I
> take my data out of the string from, trying to assign it to the
> variable crashes the program. I really, really don't want to turn on
> error trapping for the program - does anyone know of any way to check
> if specific data is numerical or text or a way to convert any text to a
> form that is handleable by an integer variable (such as turning all
> text into 0's or even their ascii codes would be acceptable)?
>
> I appreciate your time.
>
You could turn on trapping just for the one assign statement perhaps ?
whenever error continue
let numvar=numstr[1,3]
whenever error stop
if status=0 then
display numvar
else
display "Error converting"
end if
Mike Aubury
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.