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

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
avunoori
Participant
Posts: 8
Joined: Sat Oct 30, 2010 5:54 pm

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

Post 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!
Thanks,
Avunoori.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post 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
You are the creator of your destiny - Swami Vivekananda
avunoori
Participant
Posts: 8
Joined: Sat Oct 30, 2010 5:54 pm

Post 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.
Thanks,
Avunoori.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Did you assign svNum to Target field?
You are the creator of your destiny - Swami Vivekananda
avunoori
Participant
Posts: 8
Joined: Sat Oct 30, 2010 5:54 pm

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

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