How to read this packed decimal value

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
Abhijeet
Participant
Posts: 20
Joined: Wed Jul 27, 2005 1:00 am

How to read this packed decimal value

Post by Abhijeet »

How should i read the following 3 byte value in a single field.The expected value is 000030

value hex{00 00 30} - binary data

I tried using decimal packed option but its giving me an error. Now if I append a byte hex{0f} at the end , then read it using decimal pack len- 7 its working ... but i dont want to append any thing explicitly. Is there any other way by which i can directly read it.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If your data is unsigned, then using the sdk function DataTypePicCompUnsigned ought to do the trick.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In parallel jobs you can declare the value to be hex. Someone (Vincent?) posted this undocumented trick some months back.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I didn't realize that this was a PX post - sorry about that. As Ray stated, a hex value would work as this is just a binary representation of the internal format. You could also declare it as a CHAR(3) field and then take the value

Code: Select all

(Seq(In.Col[1,1])*(2**16))+(Seq(In.Col[2,1])*(2**8))+Seq(In.Col[3,1])
Post Reply