Page 1 of 1

Need help in converting packed decimals

Posted: Tue Aug 08, 2006 5:28 am
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.

Posted: Tue Aug 08, 2006 5:52 am
by pravesh_kushwaha
Can you give the sample input (Mainframe)/output(DataStage) values that you are getting after using the function.

Posted: Tue Aug 08, 2006 6:08 am
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.

Posted: Tue Aug 08, 2006 7:10 am
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.

Posted: Tue Aug 08, 2006 7:16 am
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 .

Posted: Tue Aug 08, 2006 7:36 am
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.