Implied decimals

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
bobd
Participant
Posts: 5
Joined: Fri Aug 20, 2010 2:04 pm

Implied decimals

Post by bobd »

I am reading a fixed width sequential file that contains fields with implied decimals. One field is 9 (8) V9 (2) in this field the data would look like this: 0001234512. My target is a SQL table with a varchar(10) field. I need for this value to appear in the table as ' 12345.12'. My first attempt was to use a combination of DecimalToString(StringToDecimal(value)/ 100) in a transformer stage but this yielded a blank string. Any suggestions?
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Read the field as decimal and then divide it by 100 and assign it to directly to your varchar target field. Decimal to string is default conversion.
You are the creator of your destiny - Swami Vivekananda
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

To keep it simple, I coded my similar situation DecimalToString to a VarChar stage variable, then used Trim(stage-variable) to the output column.

Check the field properties of your pic 9(08)v9(2) input column. Make sure it's defined as decimal (10,2) with display length of 10, and that your stage variable has a max value of at least 10.

I know we can do this in one derivation, but all the intermediate fields seems to trip me up. Good luck. :D
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
Post Reply