how to check if 2 numbers are equal in datastage

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
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

how to check if 2 numbers are equal in datastage

Post by pavan_test »

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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Are you sure the link is called "DSLink", not "DSLink1"?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

how to check if 2 numbers are equal in datastage

Post by pavan_test »

[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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Make sure they are varchars or true numericals.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

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>
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

how to check if 2 numbers are equal in datastage

Post by pavan_test »

[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
DatastageSolutions
Participant
Posts: 7
Joined: Wed Sep 19, 2007 1:56 am
Location: County Durham, UK

Post by DatastageSolutions »

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
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

how to check if 2 numbers are equal in datastage

Post by pavan_test »

Hi All,

thanks for the suggestions. it is working now.

Regards
Pa
Post Reply