how to check if 2 numbers are equal in datastage
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
how to check if 2 numbers are equal in datastage
Hi Al,
I have 2 Fields A and B . both of them are "varchar".
I am using a transformer and I have a constraint . this is how I wrote the constraint;
Trim(DSLink.A) = Trim(DSLink.B)
I am expecting only those rows which satisfy that above constraint in the output. how i am finding all the rows. The constraint somehow does not appear to be working.
can anyone please give me suggestions.
The actuals values for A and B are numbers such as 0021, or 0022 or 59201, 59202 etc etc. there are no decimals in my input for those Fields.
Regards
Pa
I have 2 Fields A and B . both of them are "varchar".
I am using a transformer and I have a constraint . this is how I wrote the constraint;
Trim(DSLink.A) = Trim(DSLink.B)
I am expecting only those rows which satisfy that above constraint in the output. how i am finding all the rows. The constraint somehow does not appear to be working.
can anyone please give me suggestions.
The actuals values for A and B are numbers such as 0021, or 0022 or 59201, 59202 etc etc. there are no decimals in my input for those Fields.
Regards
Pa
Are you sure the link is called "DSLink", not "DSLink1"?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
how to check if 2 numbers are equal in datastage
[quote="ray.wurlod"]Can you give us an example of a "false positive" - that is, an instance where DataStage said they were equal and you say they're not? ...[/quote]
it is actually Trim(DSLink1.A) = Trim(DSLink1.B)
thanks
pa
it is actually Trim(DSLink1.A) = Trim(DSLink1.B)
thanks
pa
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Set the pad character to space and then try. One of your fields might be coming padded with null. If still it is not working, try converting both the fields into numbers and then compare.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
how to check if 2 numbers are equal in datastage
[quote="DSguru2B"]Make sure they are varchars or true numericals.[/quote]
The data type for field A is varchar and for field B is char.
i converted field B to varchar before the data enters into transformer.
regards
Pa
The data type for field A is varchar and for field B is char.
i converted field B to varchar before the data enters into transformer.
regards
Pa
-
- Participant
- Posts: 7
- Joined: Wed Sep 19, 2007 1:56 am
- Location: County Durham, UK
As Josh said, its probably padding that's causing the problem. If you haven't got $APT_STRING_PADCHAR set then by default Datastage will pad chars with a \0 null character, in a similar way to C. Try adding $APT_STRING_PADCHAR=0x20 to the parameters. It'll tell Datastage to use spaces to pad chars out. The trims should then work correctly.
Regards,
Dave
Regards,
Dave
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
how to check if 2 numbers are equal in datastage
Hi All,
thanks for the suggestions. it is working now.
Regards
Pa
thanks for the suggestions. it is working now.
Regards
Pa