Modify Stage - Implicit 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
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Modify Stage - Implicit conversion

Post by Luciana »

Hi

I am trying to configure the modify stage. The job execute with success, but with warning in log:

Modify_12: When checking operator: When binding output schema variable "outRec": When binding output interface field "FXCRMCDPCC" to field "FXCRMCDPCC": Implicit conversion from source type "int32" to result type "string[2]": Converting number to string.

My job: SQ --> SORT --> MODIFY --> SQ

I have one column integer. I try modify to string datatype in modify stage: FXCRMCDPCC:string[2] = FXCRMCDPCC

I need conversions: Interger(2) -> Char(2)
Decimal(6) -> Char(6)

Anybody can help me?

Thank you in advance.

Regards,
Luciana
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Please search on keywords 'Converting number to string'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vkhandel
Participant
Posts: 35
Joined: Wed Oct 04, 2006 12:12 am
Location: Pune

Re: Modify Stage - Implicit conversion

Post by vkhandel »

Luciana wrote:Hi

I am trying to configure the modify stage. The job execute with success, but with warning in log:

Modify_12: When checking operator: When binding output schema variable "outRec": When binding output interface field "FXCRMCDPCC" to field "FXCRMCDPCC": Implicit conversion from source type "int32" to result type "string[2]": Converting number to string.

My job: SQ --> SORT --> MODIFY --> SQ

I have one column integer. I try modify to string datatype in modify stage: FXCRMCDPCC:string[2] = FXCRMCDPCC

I need conversions: Interger(2) -> Char(2)
Decimal(6) -> Char(6)

Anybody can help me?

Thank you in advance.

Regards,
Luciana
Hi Luciana,
For Decimal(6) -> Char(6), use the conversion function new_col_name:string = string_from_decimal(old_col_name)

For conversion from int to char... i fear there is no function available as such...or you may try using 2 Modify stages..first to convert int to decimal and then from decimal to string
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Post by Luciana »

I used the transformer stage and the job finished with success, but I thought that the modify stage was more suitable.

Code: Select all

Interger(2) -> Char(2)
----------------------
Modify     : FXCRMCDPCC:string[2] = FXCRMCDPCC
Conversion : ok
Status     : Finished (see log)
Log        : Modify_12: When checking operator: When binding output schema variable "outRec": When binding output interface field "FXCRMCDPCC" to field "FXCRMCDPCC": Implicit conversion from source type "int32" to result type "string[2]": Converting number to string.

Transformer: no function in derivation
Conversion : ok
Status     : Finished

============================================

Decimal(2) -> Char(10)
----------------------
Modify     : FXCRMCDPCC:string = string_from_decimal(FXCRMCDPCC)
Conversion : ok
Status     : Finished (see log)
Log        : OUTFILE01: When checking operator: When binding input interface field "FXCRMCDPCC" to field "FXCRMCDPCC": Implicit conversion from source type "string" to result type "string[10]": Possible truncation of variable length string.

Transformer: no function in derivation
Conversion : ok
Status     : Finished
Regards,

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

Post by ray.wurlod »

Add an extra Specification containing the single word NOWARN
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Post by Luciana »

Hi Ray

I added an extra Specification containing the single word NOWARN and the job that convert Integer to String finished with success (no warning), but the job that convert Decimal to String finished with warning.

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

Post by ray.wurlod »

Actually the warning there is about string to string[size] - that is, unbounded string to bounded string. Not sure where that's coming from, but it's clearly not covered by the NOWARN specification. Do you have a VarChar with no precision (length) anywhere in the design?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Post by Luciana »

I don't have varchar, just char.

Source:
FILLER01 - Char(30)
FXCRMCDPCC - Decimal(2)
FILLER02 - Char(2)

Target:
FILLER01 - Char(30)
FXCRMCDPCC - Char(2)
FILLER01 - Char(2)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My guess is that the unbounded string is the result of string_from_decimal(). Check with your support provider. Can you post the actual text of your conversion specification as it now stands?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ravibabu
Participant
Posts: 39
Joined: Tue Feb 13, 2007 12:18 am
Location: vijayawada

Post by ravibabu »

Hi,


Pls enable the RunTime column propagation check box in Modify Stage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why?

Runtime column propagation is anathema! It destroys any hope you might have of performing lineage or even accurate impact analysis.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Post by Luciana »

Actual text of my conversion specification is:

Specification: FXCRMCDPCC = substring[1,2] (FXCRMCDPCC)
Specification: nowarn

Thus the result is "01". I tried to use the string_from_decimal function together substring function but the job abort.

Before (the result was "01.")
Specification: FXCRMCDPCC:string = string_from_decimal(FXCRMCDPCC)
Specification: nowarn

With both specification above come back warning, but using transformer (Derivation to remove "." of the result: trim(sort.FXCRMCDPCC)[1,2]) this is solved.

Solution:
Integer to string: Transformer or Modify (nowarn) - ok
Decimal to string: Transformer - ok
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Decimal[2] wants four characters in the string: " 01.". The first character is for the sign. That's probably why string[2] generated an access violation.
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