Trying to convert Dacimal to Packed Decimal

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ashik_punar
Premium Member
Premium Member
Posts: 71
Joined: Mon Nov 13, 2006 12:40 am

Trying to convert Dacimal to Packed Decimal

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
ashik_punar
Premium Member
Premium Member
Posts: 71
Joined: Mon Nov 13, 2006 12:40 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

Yes, Craig. The CFF stage can be used as a target in a parallel job.

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

Post by chulett »

Thanks John. :D
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Surely if you can use the CFF stage as a target you don't need to effect any transformation?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply