Identifying alphabets in a numeric field
Moderators: chulett, rschirm, roy
Identifying alphabets in a numeric field
I am reading a sequential file with varchars(all fields as varchars inculding numbers) and trying to insert them into a table.The job abended with an "Invalid Number" error.One of the numeric fields contains alphabets or some wierd characters.How can I check in the transformer stage (or any other stage if I have to use one) if the incoming value is a numeric value.
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I tried using the Alnum function.Since it checks if the argument contains alphanumeric values, even a value of '1' is getting rejected. And when Nulls are encounted,I am getting the following error:
APT_CombinedOperatorController,1: Requirements Failure: Null string argument.
Requirements Failure: Null string argument.
I also tried using the Isvalid function,but got this error for Nulls:
APT_CombinedOperatorController,1: Expected identifier; got: <eof>
This is the error for a value of '1':
APT_CombinedOperatorController,2: Expected identifier; got: "1".
APT_CombinedOperatorController,1: Requirements Failure: Null string argument.
Requirements Failure: Null string argument.
I also tried using the Isvalid function,but got this error for Nulls:
APT_CombinedOperatorController,1: Expected identifier; got: <eof>
This is the error for a value of '1':
APT_CombinedOperatorController,2: Expected identifier; got: "1".
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Transformer functions are intolerant of nulls. You must handle them separately. NULL is valid for any data type (provided the receiving field is nullable). Therefore you require something like
Code: Select all
If IsNull(InLink.TheColumn) Then 1 Else IsValid("Integer", InLink.TheColumn)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.
