Check if the value is a number or not

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
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Check if the value is a number or not

Post by dspxlearn »

I have a field which can have values like '111.00','12','aaa'.
This field is defined as varchar field. I have to check if this field is a positive real numbers or not.

For values like '111.00','123.56' and '12' - i can convert into decimal values and can use the condition '>0'.
So, my concern is if i get a value like 'aaa', how do i check it?
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use the IsValid() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
svga
Participant
Posts: 73
Joined: Thu Aug 07, 2008 6:31 am
Location: Syracuse

Post by svga »

Hi,

First find the length of that field. then
use oconv function with MCN option on the same field to pull only numeric values.if both the length match then ur field contains only numeric value otherwise it would have contain non numeric data.this ill work in server edition. im not sure abt px.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. Oconv() is not available in parallel jobs.
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