IsValid function

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kpsita
Participant
Posts: 99
Joined: Tue Jul 21, 2009 11:43 pm

IsValid function

Post by kpsita »

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
KPSITA
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: IsValid function

Post by SURA »

Read this link. Is it how you used the function?

http://pic.dhe.ibm.com/infocenter/iisin ... tions.html
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
kpsita
Participant
Posts: 99
Joined: Tue Jul 21, 2009 11:43 pm

Post by kpsita »

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.

Thanks,
Amar
KPSITA
mobashshar
Participant
Posts: 91
Joined: Wed Apr 20, 2005 7:59 pm
Location: U.S.

Post by mobashshar »

Use this code:

Code: Select all

Num(Convert(".","A",mylink.mystring))
This will check mylink.mystring for Numeric Values (0-9) only. If true it will return 1 else 0.

Hope this helps :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
These are both correct results.
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.
Post Reply