|
Here's a procedure that I created to check for all numeric characters. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ H NOMAIN EXPROPTS(*RESDECPOS) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Function: Verify a character string is all numeric. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * D NUMERIC PR N D 30A Options(*VARSIZE) CONST D 5U 0 CONST P NUMERIC B Export D PI N D stringIn 30A Options(*VARSIZE) CONST D len 5U 0 CONST D b C 'x ' D n C ' 0123456789' D number S N D stringOut S 30A * MAINLINE C Clear StringOut C n:b Xlate stringIn StringOut C Eval number = (%subst(StringOut:1:len) = *Blanks) C Return number P NUMERIC E ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and this is how I use it: /Free If numeric(field_to_test:%len(field_to_test)); Do what needs to be done; EndIf; /End-Free p.s. I wrote it before /Free was available, and haven't changed it since, hence the columnar layout. -----Original Message----- From: Lurton Keel [mailto:lurtonk@xxxxxxxxxxxxx] Sent: Tuesday, January 20, 2004 12:21 PM To: rpg400-l@xxxxxxxxxxxx Subject: /Free TESTN Does anyone have an elagant way to do TESTN in /free? _______________________________________________
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.