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

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
denzilsyb
Participant
Posts: 186
Joined: Mon Sep 22, 2003 7:38 am
Location: South Africa
Contact:

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

Post 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?
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post 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.
denzilsyb
Participant
Posts: 186
Joined: Mon Sep 22, 2003 7:38 am
Location: South Africa
Contact:

Post 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?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
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