zeros being padded (prefixed) to a decimal field

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
vdr123
Participant
Posts: 65
Joined: Fri Nov 14, 2003 9:23 am

zeros being padded (prefixed) to a decimal field

Post by vdr123 »

-Pulled in metadata using orchestrate method in table def

-intiger came in as decimal(38,10)

-when data flows through these fields, its padding zeros(0) in the front.

example: oracle db has intiger 101

DS is reading as "000000000000000101" (lots of zeros)

Any reason this is happening?

Any way to fix this, any APT_ variable to change ? or something to do with fixed width field?(how to declare this or handle this)

This is creating issues with lookup, as its comparing this value to 101 and also writes these zeros to a flat file.

This is happening for all the number fields, so its not good to apply trim or removing leading zeros with functions.

APT_STRING_PADCHAR is 0x0, in the project -- any relavence?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The reason, as you would have learned had you bothered to Search, is that Decimal data types are always displayed to full precision and scale, as a visual guarantee that these are correct.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vdr123
Participant
Posts: 65
Joined: Fri Nov 14, 2003 9:23 am

Post by vdr123 »

I did search the forum.

Issue is its writing these zeros to DS, flat file.

When I load this data to oracle db, its fine.

I am doing a CDC using SCD on this data loaded in db and incoming source data.

Will it impact the lookup.

Also, when I write this data to a varchar field, it holds on to zeros.

Is there a way to change the import metadata using orchestrate table def's to a bigint or int, rather than decimal?(without manually changing each one)
nayanpatra
Participant
Posts: 41
Joined: Sat Jun 06, 2009 11:13 pm
Location: Kolkata

Post by nayanpatra »

You can do the lookup in either of the below mentioned ways:

1) You can convert the leading zeros to space, trim the data with varchar datatype and then perform the lookup.

2) You can convert the field which you are looking up into Decimal datatype and then perform the lookup.
Nayan
Post Reply