Page 1 of 1

Modify Stage - Implicit conversion

Posted: Fri May 18, 2007 8:58 am
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

Posted: Fri May 18, 2007 10:44 am
by DSguru2B
Please search on keywords 'Converting number to string'.

Re: Modify Stage - Implicit conversion

Posted: Fri May 18, 2007 10:51 am
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

Posted: Fri May 18, 2007 11:25 am
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.

Posted: Fri May 18, 2007 5:35 pm
by ray.wurlod
Add an extra Specification containing the single word NOWARN

Posted: Fri May 18, 2007 7:33 pm
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

Posted: Fri May 18, 2007 9:37 pm
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?

Posted: Sun May 20, 2007 1:27 pm
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)

Posted: Sun May 20, 2007 2:26 pm
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?

Posted: Mon May 21, 2007 5:45 am
by ravibabu
Hi,


Pls enable the RunTime column propagation check box in Modify Stage.

Posted: Mon May 21, 2007 5:56 am
by ray.wurlod
Why?

Runtime column propagation is anathema! It destroys any hope you might have of performing lineage or even accurate impact analysis.

Posted: Mon May 21, 2007 7:31 am
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

Posted: Mon May 21, 2007 3:15 pm
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.