string_from_decimal showing warning

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
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

string_from_decimal showing warning

Post by Ragunathan Gunasekaran »

Hi
I am using this function to convert a decimal to the string .
I am getting warnings as

Code: Select all

implicit conversion from source type "string" to result type "string[max=4]": Possible truncation of variable length string.
The stuff is its taking string without any length and converting it to a string of a particular length.

When i explicitly specify the length then also it throws warning as
It doesn't have enough room for holding the decimal say when i give string[12] for decimal[11,0].When i inrease the length of the string then it shows the First said truncation warning . How shall i avoid these Possible truncation warnings and not enough room for holding decimal warnings .
Please help ....





[/b]
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The string for a decimal needs to have at least two more character positions than the precision of the decimal data type, one for the decimal placeholder character and one for the sign character (which may be a space).

When converting from an unbounded string to a bounded string (for example string to string[max=4]) there is no way to avoid the alert, because DataStage wants to alert you to the possibility of lost data - even though you might be using a Left() function or similar - it's test is done purely on the metadata (record schema). In this case, the only option seems to be a message handler to demote the severity of the logged message.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ragunathan Gunasekaran
Participant
Posts: 247
Joined: Mon Jan 22, 2007 11:33 pm

Post by Ragunathan Gunasekaran »

Hi ,
As said i have added some more length into the string but it still throws truncation warning ie Possible truncation of string[14] to string[12]. The output tab holds the metadata as string[12]( This is the metadata that the target table has)
Regards
Ragu
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, because DataStage still has to alert you about the possibility that your data may be truncated.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

add one more specificaion into Modify satage

and write NOWARN , it will not issue warning messages.
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
Post Reply