Page 1 of 1

string "0" = "00" but integer 0 = 00

Posted: Tue Feb 22, 2005 8:17 am
by denzilsyb
Hi guys

When comparing "0" = "00" character datatypes, why does datastage insist that the values are equal? Is DS converting the chars to internal numeric values before comparing?

I have tried CRC32 and CHECKSUM on the values and when comparing they are definitely not the same. Whats going on behind the scenes?

Posted: Tue Feb 22, 2005 8:42 am
by chucksmith
Behind the scene, DataStage is performing a character to numeric conversion before the comparison. To force a character comparison, use the Compare() function.

Posted: Tue Feb 22, 2005 8:50 am
by denzilsyb
chucksmith wrote:Behind the scene, DataStage is performing a character to numeric conversion before the comparison.
Thanks Chuck, does this mean that every character comparison done in a transformer is converted behind the scenes?

Posted: Tue Feb 22, 2005 6:27 pm
by ray.wurlod
Only if both arguments are numeric.
Conceptually:

Code: Select all

If Num(Arg1) And Num(Arg2)
Then
   Result = Compare(Arg1, Arg2, "R")
End
Else
   Result = Compare(Arg1, Arg2, "L")
End