Modify Stage - Conversion

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
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Modify Stage - Conversion

Post by devidotcom »

Hi,

Please help in converting a source field of datatype NVarchar(120) Nullable to target field of decimal(120) Not Nullable using a modify stage.

Thank you.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What exactly would a Decimal(120) be? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The function is decimal_from_ustring but, like Craig, I am puzzled about precision 120 on a decimal field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
wfis
Premium Member
Premium Member
Posts: 70
Joined: Wed Feb 28, 2007 2:38 am
Location: India

Post by wfis »

Oops. Thanks for the reply.

Yes its from NVarchar(120) to Decimal 8
I am sure the source data will hold not more than 8 chars from the source based on one filtering criteria. How do we eliminate the warnings it throws any due to this.

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

Post by ray.wurlod »

What warnings are these?

Do you have a NOWARN specification in your Modify stage? (These are really about nullability warnings, so I doubt that they'd be legitimate here.)

Is there any reason you can't use NVarChar(8) as the input data type - possibly derived upstream using a substring operation?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

The warnings are telling you your code is not robust. You are converting NVARCHAR to decimal - what happens to non numerics in that field? You are converting nullable to NOT NULL which means you will lose rows if a null is encountered. I would convert this in a Transformer instead with a NullToValue followed by a Decimal check followed by the conversion and a reject link for those rows that do not work. Transformer will let you do validation in a stage variable and nested conversion in a cell.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or a Modify stage using handle_null() !

But there's no Modify stage equivalent of 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.
Post Reply