Remove leading dot in the decimal value of fixed length

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
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Remove leading dot in the decimal value of fixed length

Post by spendem »

Hi All,

I want to remove the leading "." i.e dot in the decimal value.

Example: Input is date(10) = 2005-05-18 after coverting the date to decimal
Output is Decimal(8) = 20050518.

My requirement is to get Decimal(8) = 20050518 i.e I want to skip the . (dot) value.

I tried using trim function and even tried reading the output in Char and Varchar data type but didn't work out.

Can anyone please help me out on how to achieve this in Enterprise Edition.


Many Thanks,
Spendem
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Hi Spendem

try following one

[b]Trim("20050518.", ".", "A")[/b]


I hope it will give correct result..


Thanks
Man
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The dot may not actually be there. It may be an artifact of the data browser. Does the dot get through to your target? If so, convert its data type to int64 or uint64 and the dot will vanish.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Post by spendem »

Hi,

Thanks for the answers,
Mandiyil what is ? I tried using it I am getting a validation error.

Ray,
If I m using BigInt or Integer(64) The preecing zeros seems to dissapear for Numeric field.

Is there any other round?

Many Thanks,
Sandeep
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Hi


i am sorry pls try following one. try Ray suggested way also.

Trim("20050518.", ".", "A")


Man
mspanda
Participant
Posts: 32
Joined: Tue May 09, 2006 6:22 am
Location: bangalore

Re: Remove leading dot in the decimal value of fixed length

Post by mspanda »

Hi
i hope the following line helps you to get your required output

Ereplace("2005-05-18 ","-","")

Thanks
-Mspanda


spendem wrote:Hi All,

I want to remove the leading "." i.e dot in the decimal value.

Example: Input is date(10) = 2005-05-18 after coverting the date to decimal
Output is Decimal(8) = 20050518.

My requirement is to get Decimal(8) = 20050518 i.e I want to skip the . (dot) value.

I tried using trim function and even tried reading the output in Char and Varchar data type but didn't work out.

Can anyone please help me out on how to achieve this in Enterprise Edition.


Many Thanks,
Spendem
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

spendem wrote:If I m using BigInt or Integer(64) The preecing zeros seems to dissapear for Numeric field.
Leading zeroes are not relevant for integer data types. Your original question made no mention of any need to preserve leading zeroes. You can add leading zeroes later, but I can not think of any way to preserve non-significant leading zeroes AND losing the dot.
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