Page 1 of 1

Trying to convert Dacimal to Packed Decimal

Posted: Wed Aug 08, 2007 12:24 am
by ashik_punar
Hi Everyone,
I am trying to convert decimal of 5,2 and 4,0 to packed decimal.
If anybody has the solution ,Can you please shere with me.
Thank in advance
Ashik

Posted: Wed Aug 08, 2007 12:47 am
by ArndW
Two options are either output to a CFF stage and make DataStage do the conversion for you or use the sdk builtin routine "DataTypePicComp3Unsigned" to explicitly convert that value to the binary representation.

Posted: Wed Aug 08, 2007 2:26 am
by ashik_punar
ArndW wrote:Two options are either output to a CFF stage and make DataStage do the conversion for you or use the sdk builtin routine "DataTypePicComp3Unsigned" to explicitly convert that value to the binary representation.
i am trying to use the routine "DataTypePicComp3Unsigned" But the problem i am facing is i have four columns
colA colB colC colD
4,2 5,0 7,0 9,3

Input value
1254.12 for ColA
14528 for ColB
7485962 for ColC
987456321.123 ColD

But after using the above function i am getting some values are like

0 for ColA
313435323 for ColB
37343835 for ColC
0 for ColD

But when i am using "DataTypePicComp3UnsignedFast"

The output value i am getting is

1254.12 for ColA
313435323 for ColB
37343835 for ColC
987456321 ColD

Can any body Help me regarding the same.
Thanks in Advance
Ashik

Posted: Wed Aug 08, 2007 7:03 am
by chulett
Those sdk routines convert fields from those types, not to them. If you're unwilling to use the CFF stage, you'll need to build your own version of those routines that 'go the other way'.

Posted: Wed Aug 08, 2007 9:28 am
by ds_developer
Just a couple of clarifications:

1. the CFF stage cannot be used as a target in the Server edition - it does not support input links.
2. you can write a packed decimal using the sequential file stage, but it will involve a DS Transform call or a routine. I've done it before but I don't have the code with me right now. I think it involved a "MD" conversion - look at the document Basic.pdf.

John

Posted: Wed Aug 08, 2007 9:37 am
by chulett
1. Wasn't aware of that, never having needed the services of the CFF stage as of yet. Guess all the discussions I think I've read where it is used as a target have been over in the PX world, eh?

Posted: Wed Aug 08, 2007 11:58 am
by ds_developer
Yes, Craig. The CFF stage can be used as a target in a parallel job.

John

Posted: Wed Aug 08, 2007 12:06 pm
by chulett
Thanks John. :D

Posted: Thu Aug 09, 2007 4:10 pm
by ds_developer
... back to the original question. I have yet to find the transform function I had for writing a packed decimal field. I will continue looking. Does anyone else have any help?

John

Posted: Thu Aug 09, 2007 4:11 pm
by ray.wurlod
Surely if you can use the CFF stage as a target you don't need to effect any transformation?

Posted: Thu Aug 09, 2007 10:28 pm
by chulett
ds_developer wrote:the CFF stage cannot be used as a target in the Server edition - it does not support input links.
Shirley is using a Server job.