Skip to Content
avatar image
Former Member

ASCII to EBCDIC packed decimal

Hi everyone,

I need to convert some numerical string into a Package field in EBCDIC in order to write a file and send it to some mainframe system. I have using an ABAP proxy like sender and a File adapter like the reciver.

I have made some java function that takes every two characters and merge them into a single byte (like the mainframe can read it). I tested the function and evreything goes well in my PC, but when I create a simple user-defined function and try to make the conversion it writes the characters incorrectly.

But this only happen when the character are < 10.

I mean If I send a 999999 I have in my file ™™™œ This is correct becuase the hexadecimal representation is 99 99 99 9C.

But when I send 123456 I have in my mapping this string ##El but this is incorret because the hexadecimal code is <b>23</b> 23 45 6C and this should be #El hex: <b>01</b> 23 45 6C and I have this correct result when I run it in my PC.

does anybody have any idea why happens this???

or does anybody has another way to solve the problem of the packed fields???

I guess there is an internal conversion in the mapping, and cannot read the characters like 0000 0001.

I really appreciate your help

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 18, 2005 at 05:32 AM

    Hi Omar Hernandez,

    We had the similar scenario in one of our project and we too faced the similar problem with XI Mapping, so we did the mapping without EBCDIC conversion [With necessary padding as the mainframe s/m expects a fixed length field values] and used the Operating system command in File Adapter to convert the XML data into EBCDIC data [ofcourse removed xml tags from the message before converting into EBCDIC format].

    Stpes:

    1.Normal Mapping with padding for fields [to make fixed length field values].

    2.Write a Java program to remove XML tags from the message and convert the flat records into EBCDIC format [it should work on filenames from command line arguments].

    3.Deploy the Java program into server.

    4.Use the Operating system command in FILE ADAPTER to call the Java program [Use %F to pass the filename from Adapter].

    Hope this solves your issus.

    Regards,

    Ananth

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Omar Hernandez,

      1.Yes you can use file content conversion to remove XML tags before converting it to EBCDIC format and that would be the better approach.

      2.I am not sure, but I hope the reverse process should solve the Mainframe to ABAP Proxy scenario.

      MainFrame[plain file] -> XI - FileAdapter content conversion ->
        XI - Mapping -> ABAP Proxy

      Regards,

      Ananth