Page 1 of 1

How to remove sign to a decimal[7,3]

Posted: Mon Nov 01, 2010 9:36 am
by avunoori
Hi,

I have a decimal(7,3)
eg: +1234.567 or -1234.567 need O/p as 1234.567

Also IF more than 4 positions to left or more than 3 positions to right reject.

eg: +12345.67 reject
+123.4567 reject

How to implement this can any one help me am new to datastage!

Posted: Mon Nov 01, 2010 10:05 am
by anbu

Code: Select all

svNum=Trim(Convert('+-','',Input))
Use this as transformer constraint

Code: Select all

Len(Field(svNum,'.',1)) < 4 And Len(Field(svNum,'.',2)) < 3

Posted: Mon Nov 01, 2010 10:33 am
by avunoori
anbu wrote:

Code: Select all

svNum=Trim(Convert('+-','',Input))
Use this as transformer constraint

Code: Select all

Len(Field(svNum,'.',1)) < 4 And Len(Field(svNum,'.',2)) < 3

I can still see the signs in output file. convert is not working.Help me Please.

Thanks in advance.

Posted: Mon Nov 01, 2010 10:50 am
by anbu
Did you assign svNum to Target field?

Posted: Mon Nov 01, 2010 10:58 am
by avunoori
anbu wrote:Did you assign svNum to Target field?
I have used svNum as stage variable and assigned the stagevariable to target field as constraint.

Thanks for responding.

Posted: Tue Nov 02, 2010 12:33 am
by ray.wurlod
The approaches thus far seem to be overly complex. It seems to me that there are two separate things to solve: removal of the sign and checking of the structure.
Use Convert() or Abs() to strip the sign.
Test that result. You could use IsValid() to test for Decimal(7,3) or you could convert to string and check for a decimal placeholder in the fifth character position.