'NULL' string not replacing in Transformer.

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

'NULL' string not replacing in Transformer.

Post by snt_ds »

Hi Dsxians,

I am experiencing a strange problem in transformer stage for some columns and for some datastage
jobs alone ,when i am trying to replace a 'NULL' string from source with setnull() function for a target
decimal column 28,12.Derivation is below.

If Trim(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)='NULL' Then setnull() Else StringToDecimal(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)

Even if i am not mapping this column with 'NULL' value to target I am getting this below warning.

TRN_POS_VALIDATIONS,0: A numeric string was expected, got "NULL"; using Decimal, the default value. [transform/tfmop_functions.C:448]

Could you please let me know any suggessions or thoughts.Thanks for your time.

Thanks
snt_ds
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... just to be clear... when you say a null string here, you actually mean a string with the value of "NULL", yes? What is the source data type?
-craig

"You can never have too many knives" -- Logan Nine Fingers
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Thanks chulett for the reply.

Yes. A string with value of "NULL".If source file column is empty or NULL value then i am replacing with "NULL" string.Datatype is varchar.

IF IsNull(ACTION_SRC_1_PositionDataFromPAM.BOOK_VALUE) Then 'NULL' Else if Trim(ACTION_SRC_1_PositionDataFromPAM.BOOK_VALUE) = '' then 'NULL' else Trim(ACTION_SRC_1_PositionDataFromPAM.BOOK_VALUE)

Later replacing this string with setnull() in final dataset for target decimal column 28,12.

If Trim(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)='NULL' Then setnull() Else StringToDecimal(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)



Thanks
snt_ds
sureshabbisetti
Participant
Posts: 21
Joined: Thu Oct 04, 2007 4:34 am
Location: India
Contact:

Post by sureshabbisetti »

Hi

Try with below logic
If Trim(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)='' Then setnull() Else StringToDecimal(ACTION_SRC_3_PAMPositionAfterExchangeJoin.BOOK_VALUE)

Otherwise use stage variable to check the column value is null or not

Please correct me If I am wrong

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

Post by ray.wurlod »

Please be corrected. You must handle the "genuine null" first because functions such as StringToDecimal() are intolerant of them.
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