How to find how many digits to concatenate

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
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

How to find how many digits to concatenate

Post by synsog »

Hi All,

I have source fields column name, data_type, Field_size respectively. Suppose if actual value of column=155
Data_type of column=NUMBER
Field_Size of column=40

then I need to load the column value into target as
2000000000000000000000000000000000000155.


So please let me know how to get this.

Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

While I am not sure that 40 digits are allowed (38 are), you have two basic approaches to creating your decimal number - either as a string and then convert it, or as a number. I'm also unsure of whether the transform stage compiler will take a 40-digit numeric constants as follows:

Code: Select all

In.Column+2000000000000000000000000000000000000000
but you won't know until you've tried it.
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Post by synsog »

Hi ArndW, Thanks for reply. But the length is not fixed for all the columns and also it vary colum by column. What I am trying to say here is if the length is 12 and we got a value of 1234 then target shouldbe 200000001234.

For other columns field_size may differ.

Thanks
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In that case:

Code: Select all

In.Number+LEFT("200000000000000000000000000000000000000000",In.Length)
Post Reply