Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Free- Form equivilant to TestN()

Status
Not open for further replies.

Fooch

Programmer
Dec 19, 2005
63
US
Does this exist? I need an easy way to check if the value that was passed in from a CL is a valid number. Because of they don't pass the number in as three chars(ie '060', '040', etc) RPG pulls the values as junk. There is no way for the CL to pass me a number and get it correctly in the RPG. So I want to be able to monitor for the developer sending the value in the right format.
 
I hate TESTN.

What I do is:

Code:
        If %CHECK('0123456789':Char_Field) = 0; 
           // the character field is all numeric.
        Else;
           // there are non-numeric characters in the character field
        Endif;


Solum potestis prohibere ignes silvarum.

 
When I want to test for numeric I do
monitor
numfield = %decimal(charfield:8:0)
on-error
... send msg or whatever
end-mon

it ignores blanks and aligns decimals automatically.

 
Arrow483,

Isn't that %dec, not %decimal?

Solum potestis prohibere ignes silvarum.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top