Hi,
I have a source field from file with CHAR10. I need to check if it is a valid integer. I tried using IsValid function. This worked fine non numeric fields, but even for decimal it validates as a valid number. I need to capture other than integer (including decimal) as not a valid numeric field. How do I get this.
Thanks
IsValid function
Moderators: chulett, rschirm, roy
Re: IsValid function
Read this link. Is it how you used the function?
http://pic.dhe.ibm.com/infocenter/iisin ... tions.html
http://pic.dhe.ibm.com/infocenter/iisin ... tions.html
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
-
- Participant
- Posts: 91
- Joined: Wed Apr 20, 2005 7:59 pm
- Location: U.S.
Use this code:
This will check mylink.mystring for Numeric Values (0-9) only. If true it will return 1 else 0.
Hope this helps
Code: Select all
Num(Convert(".","A",mylink.mystring))
Hope this helps
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
These are both correct results.kpsita wrote:Yes I did try IsValid("int8",mylink.mystring). But for valid values like 22222 and some of the decimal values like 1.0222, it is throwing 0.
22222 is too large for int8; it can be int16, int32 or int64.
1.0222 simply is not an integer of any kind.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.