Page 1 of 1

how to check if 2 numbers are equal in datastage

Posted: Sun Oct 07, 2007 8:44 pm
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

Posted: Sun Oct 07, 2007 10:25 pm
by ArndW
Are you sure the link is called "DSLink", not "DSLink1"?

Posted: Mon Oct 08, 2007 12:04 am
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?

how to check if 2 numbers are equal in datastage

Posted: Mon Oct 08, 2007 8:07 am
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

Posted: Mon Oct 08, 2007 8:17 am
by DSguru2B
Make sure they are varchars or true numericals.

Posted: Mon Oct 08, 2007 8:18 am
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.

how to check if 2 numbers are equal in datastage

Posted: Mon Oct 08, 2007 8:20 am
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

Posted: Mon Oct 08, 2007 9:35 am
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

how to check if 2 numbers are equal in datastage

Posted: Mon Oct 08, 2007 4:34 pm
by pavan_test
Hi All,

thanks for the suggestions. it is working now.

Regards
Pa