column is taking more than defined length in dataset

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
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

column is taking more than defined length in dataset

Post by ambasta »

Hi,
Source is Oracle[decimal(15,3)] and target is dataset[decimal(15,3)].
from source 10000024.35 data is coming but when i m viewing in dataset it is stored as [ 000010000024.350],that means 13 integer and 3 decimal part.but length is defined as decimal(15,3).can anyone please help me.

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

Post by ray.wurlod »

There are 15 digits in 000010000024.350 (count them). That means decimal[15,3] in my book. "Precision" is the number of digits in the number, not the number of digits to the left of the decimal place.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, precision is the total number of digits in the number, not the number to the left of the decimal. Scale is the portion of the precision to the right of the decimal.

So, a decimal(3,2) could not store 10 as a value.

ps. Don't count the decimal in the precision.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

Thanx for ur kind suggession.
I think you are mistaken,[ 000010000024.350] is taking 13 places for integer,as there is a blank space before 0 at the starting place.
later my reqirement is to write this dataset into a fixed width file having length(15,3)but my file is also occupying 16 places instead of 15.
ambasta
madhukar
Participant
Posts: 86
Joined: Fri May 20, 2005 4:05 pm

Post by madhukar »

Space at starting of a decimal specifies the "sign position" which is a default property. Space indicates a positive value.
To avoid the space you have to set the field width property.
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

If this space is coming in dataset,it is ok for me.but when i m writing to sequential fixed width file this blank space is also taking one space.this i do not want..can you plz suggest me any alternative.

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

Post by ray.wurlod »

Convert to string and trim the leading space character. Note that this may produce wrong answer if your numeric value is negative.
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