Need help in converting packed decimals

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
jojipjohn
Participant
Posts: 52
Joined: Wed May 17, 2006 3:40 am
Location: India

Need help in converting packed decimals

Post by jojipjohn »

In my projects I am getting source files from Mainframe system in packed format. I am converting this using the tranformation "DataTypePicComp3()",but we are not getting correct values after conversion. Could anyone help me in this. Is there any other transformation for this.
Joji John
pravesh_kushwaha
Participant
Posts: 19
Joined: Fri Sep 10, 2004 12:17 am
Location: India
Contact:

Post by pravesh_kushwaha »

Can you give the sample input (Mainframe)/output(DataStage) values that you are getting after using the function.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Often if the mainframe packed data doesn't seem to be correct the real reason is that the file is being converted from EBCDIC to ASCII and thereby corrupts the packed data. If that is the case you can convert those fields back using the DB EBCDIC function and then apply your SDK function.
jojipjohn
Participant
Posts: 52
Joined: Wed May 17, 2006 3:40 am
Location: India

Post by jojipjohn »

By DB EBCDIC function do you mean the database functions. We are using Oracle 9i database. WE could not find a way to load this packed format into Oracle tables. Could you please help us on this.
Joji John
jojipjohn
Participant
Posts: 52
Joined: Wed May 17, 2006 3:40 am
Location: India

Post by jojipjohn »

I tried the "DD if=<> of =<> conv=<>" unix command. But Even this corrupts the data. I had 18 lines of records in the source after converting using the "DD" function this was reduced to 2 .
Joji John
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Ok... help us help you here. Just to make sure we're all on the same page, when you say 'packed format' what exactly do you mean? COMP-3? Signed or Unsigned? Don't forget, packed is packed (neither EBCDIC nor ASCII) and requires no 'conversion', mearly unpacking.

As noted, some transfer mechanisms can automatically convert a mainframe EBCDIC file to an ASCII one and if that isn't done correctly the packed fields get converted as well - which corrupts them. Which is what you did with the DD command, I'd wager. Any idea if that is happening without DD, because if it is you'll never unpack them gracefully.

Assuming all is well in packed land, correct datatypes helps. Define the incoming field as Char or Varchar (typically half the size of the output) and then use the appropriate SDK routine to convert it to a numeric field. The end result should load just fine into Oracle.

If you still have problems, specific examples of your input and converted output would help solve it.
-craig

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