Schema files - variable length - decimal

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
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Eventhough you posted it in server forum, i think its related to PX.

Datastage pads non significant zeros to decimal and hence the behaviour you saw in datastage management utility. If the values are correct there is no problem at all.

If you are loading it to database decimal field, there is no problem as you won't see the padded zero from database.

If you are writing it to sequential file, you can convert it to varchar using decimaltostring() with supress_zero rtype and then write it to file.It doesn't matter what datatype you are writing to a sequential file as it won't preserve the metadata.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
mcas
Premium Member
Premium Member
Posts: 3
Joined: Wed Dec 02, 2009 11:43 am

Post by mcas »

priyadarshikunal wrote:Eventhough you posted it in server forum, i think its related to PX.

Datastage pads non significant zeros to decimal and hence the behaviour you saw in datastage management utility. If the values are correct there is no problem at all.

If you are loading it to database decimal field, there is no problem as you won't see the padded zero from database.

If you are writing it to sequential file, you can convert it to varchar using decimaltostring() with supress_zero rtype and then write it to file.It doesn't matter what datatype you are writing to a sequential file as it won't preserve the metadata.
Thanks priyadarshikunal!

The issue when writing to Seq File is that i'm using Schema files and i can't use functions as their are no columns.

DataSet --> Transformer --> Seq_File
(RCP)

But my problems comes when handling null. On the output sequential stage, if i use the field default null_field_value='' it reports the following warning:"null_field length (0) must match field's fixed width (28 )" because it assumes that all decimal fields are fixed length. This error is shown for every decimal field.

If i don't use the null_field_value i get the following warning: "Exporting nullable field without null handling properties"

So, using the null_field_value always show a warning. In this case, when writing to a sequencial file from a Dataset, always have present that the job has no columns to set individual properties or use transformer function. You only have the Seq Stage properties pane.

This is a small look of the output:

Code: Select all

C_EMEA_GB_5_201012091120|EMEA|GB|5| 00000000000000001357525.000| 00000000000000000651612.000| 00000000000000001248923.000| 00000000000000001900535.000| 00000000000000000054301.000| 00000000000000000597311.000| 
How can i change this post to Parallel? Do i have to copy everything?

Thanks!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

mcas wrote:How can i change this post to Parallel? Do i have to copy everything?

Thanks!
You cannot but luckily I can. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

In the schema file defined for the sequential file (input/output) define the decimal column like -

Code: Select all

USD_TA: not_nullable decimal[26,3] {null_field='00000000000000000000000000'};
mcas
Premium Member
Premium Member
Posts: 3
Joined: Wed Dec 02, 2009 11:43 am

Post by mcas »

mhester wrote:In the schema file defined for the sequential file (input/output) define the decimal column like -

Code: Select all

USD_TA: not_nullable decimal[26,3] {null_field='00000000000000000000000000'};
My intention is to take the output to a variable-length format. This way i'll be writing fixed length.

If i have a NULL value i would like to print simply (""). Which is the expected output format.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

what about reading everything as varchar?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply