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
phanikumar
Participant
Posts: 60 Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA
Post
by phanikumar » Wed Jan 11, 2012 10:41 pm
I have a filed called Phone_No where in I need to check whether the incoming data is numeric or not.Can some one let me know how to do this validation to find out if it is a numeric field or not.
Regards
Kumar
SURA
Premium Member
Posts: 1229 Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney
Post
by SURA » Wed Jan 11, 2012 10:54 pm
Cant you use NUMS funcation?
DS User
phanikumar
Participant
Posts: 60 Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA
Post
by phanikumar » Wed Jan 11, 2012 11:08 pm
Can someone tell me how to use the num function to find out if all the fields from the source are numeric
SURA
Premium Member
Posts: 1229 Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney
Post
by SURA » Wed Jan 11, 2012 11:13 pm
Num (col).
You can see the example in your help.
DS User
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Wed Jan 11, 2012 11:24 pm
What is the data type of the incoming field? For example if it is int32 or decimal, you don't need to check - it can not but be numeric.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Posts: 1399 Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU
Post
by pandeesh » Thu Jan 12, 2012 12:20 am
Either you can use Num() or the below old technique:
Code: Select all
if len(Convert("0123456789","",YourField))=0 then numeric else non-numeric
pandeeswaran
kmsekhar
Premium Member
Posts: 58 Joined: Fri Apr 16, 2010 12:58 pm
Location: Chn
Post
by kmsekhar » Thu Jan 12, 2012 1:15 am
As suggested by Ray if the incoming data is not (Int32,Decimal) datatype then another way to check for numeric data
Code: Select all
If IsValid("int32", InputColumn) Then "Int" Else "Var"
Thanks,
Sekhar
phanikumar
Participant
Posts: 60 Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA
Post
by phanikumar » Thu Jan 12, 2012 3:49 pm
The data type for this field is coming as varchar and when I use Num(i/pcol)
it is giving me a warning message like null string argument.
SURA
Premium Member
Posts: 1229 Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney
Post
by SURA » Thu Jan 12, 2012 4:23 pm
Num(NullToEmpty(col))
I am not sure how this will work. But give it a go.
When you share the warning, cant you provide the entire warning detail!!
DS User
phanikumar
Participant
Posts: 60 Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA
Post
by phanikumar » Thu Jan 12, 2012 5:30 pm
I did handle the nulls by doing Null to Empty and used the Num function, it doesn't work.Still come up with warnings.The entire warning message is like null string arguments and I had some thousands of these warnings.
SURA
Premium Member
Posts: 1229 Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney
Post
by SURA » Thu Jan 12, 2012 6:49 pm
In which stage it is giving warning?
Copy and paste the warning.
DS User
phanikumar
Participant
Posts: 60 Joined: Tue Sep 20, 2011 10:44 pm
Location: INDIA
Post
by phanikumar » Thu Jan 12, 2012 8:46 pm
Hi
I fixed this issue by handling the spaces, when I am using Num function previously I was not taking care of spaces. So I did null to Empty(str) = ' ' then i replaced with some value.Hence the problem is solved.Thank you for all your inputs.
Regards
Kumar
pandeesh
Premium Member
Posts: 1399 Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU
Post
by pandeesh » Thu Jan 12, 2012 8:57 pm
Please resolve the topic, your issue gets resolved.
Thanks
pandeeswaran