Re: Fwd: Identifying numeric string in a 4gl program
Posted in 2000
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Because "." and "e" and such can be part of legit numeric strings, I use the "whenver any error continue" statement, and check the status after putting the character string into a numeric field. main define x integer # may need to be decimal define y char(10) whenever any error continue let y = "4.3e2" let x=y display y, " ", x, " ", sqlca.sqlcode, " ", status let y = "hello" let x=y display y, " ", x, " ", sqlca.sqlcode, " ", status let y = "4.3i2" let x=y display y, " ", x, " ", sqlca.sqlcode, " ", status whenever any error stop end main fglgo x 4.3e2 430 0 0 hello 0 0 -1213 4.3i2 0 0 -1213 Hortencia Ake wrote: > > >Date: Wed, 20 Dec 2000 17:59:53 -0600 > >To: informix@iiug.org > >From: Hortencia Ake <hake@btl.net> > >Subject: Identifying numeric string in a 4gl program > > > >hi everyone, > > > >can anyone assist on how to know when a string is a pure numeric string in > a 4gl program. > >this is necessary so as to tell the user when running the program that the > string entered is only numeric. > > > >thanks for your assistance > > -- Colin
Colin McGrath wrote in message <91trsu$d9k$1@news.xmission.com>... > >Because "." and "e" and such can be part of legit numeric strings, I use >the "whenver any error continue" statement, and check the status after >putting the character string into a numeric field. > Small warning though: I did that a few years ago (V 4.1? 4GL) and it left an endless stream of messages in the errorlog file - ie the error file you associate with the running program using the startlog() function. Hopefully this has been fixed in later versions of 4GL, but I suggest you check for it in your version. Feedback on this would be appreciated.