Decimal to string conversion

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
rumu
Participant
Posts: 286
Joined: Mon Jun 06, 2005 4:07 am

Decimal to string conversion

Post by rumu »

Hi All,

I am reading binary file(EBCDIC format) through CFF stage and writing to a sequential file in "^" delimited which will be consumed by downstream application. The down stream application will read the file and load as is into a Hive table in HDFS and all the fields type are string.
So When I read a packed decimal field through CFF stage, in following transformer, I am using Decimal To String(Link.Col,"suppress_zero") and setting the target column type as Varchar in sequential file keeping the same width as that of input decimal field.
So this is converting, -00000045.10 to -45.1 and -0000000001.00 to -1. My decimal field is 17,2 so I am keeping target field as Varchar 17. is that correct?

Secondly, there are some Decimal field in source without scale ie Decimal 3, Decimal 7 etc.

There I found issue while using above DecimalTo String function hence I used AsInteger(Ln.Column) and set the target datatype as Varchar.
So this transformation gives me following result:

088 converted to 88
008 converted to 8

My qs is , is my rule correct? As the target is sequential file and other application will load the data as string so is my above conversion rule correct?
Rumu
IT Consultant
Post Reply