Problem in converting EBCDIC to ASCII in ODI

Hi All,
I am new to ODI.
I am trying to convert EBCDIC file to ASCII using ODI. Each of my record is of length 140. There is no record separator, but in ODI we need to specify record separator.
So how do i convert this file.
I am using jdbc:snps:dbfile?ENCODING=cp037 in my data server.
IS there any way by which i can tell ODI that the next record is after 140 characters???
Thanks

Yeah, I ended up going the Jython route.
First I created a procedure called "ftpGetEbcdicFile" that takes the following options:
1 Remote Server
2 Remote Login
3 Remote Password
4 Remote Directory
5 Remote Filename
6 Local Directory
7 Local Filename
8 Record Size
This procedure has 2 commands/steps:
ftpGetBinary:
import snpsftp
# Retrieve procedure parameters
remoteServer = '<%=odiRef.getOption("Remote Server")%>'
remoteLogin = '<%=odiRef.getOption("Remote Login")%>'
remotePassword = '<%=odiRef.getOption("Remote Password")%>'
remoteDirectory = '<%=odiRef.getOption("Remote Directory")%>'
remoteFilename = '<%=odiRef.getOption("Remote Filename")%>'
localDirectory = '<%=odiRef.getOption("Local Directory")%>'
localFilename = '<%=odiRef.getOption("Local Filename")%>'
# Build full file paths
remotePath = remoteDirectory + "/" + remoteFilename
localPath = localDirectory + "/" + localFilename
# Execute ftp
ftp = snpsftp.SnpsFTP(remoteServer, remoteLogin, remotePassword)
try:
     ftp.get(remotePath, localPath, 'BINARY')
finally:
     ftp.close()
and insertNewlines:
# Retrieve procedure parameters
localDirectory = '<%=odiRef.getOption("Local Directory")%>'
localFilename = '<%=odiRef.getOption("Local Filename")%>'
recordSize = <%=odiRef.getOption("Record Size")%>
localPath = localDirectory + "/" + localFilename
# There is probably a better way to do this
tmpPath = localDirectory + "/" + localFilename + "~"
inputFile = open(localPath, 'rb')
outputFile = open(tmpPath, 'wb')
while 1:
     line = inputFile.read(recordSize)
     if line:
          outputFile.write("%s%c" % (line, 0x15))
     else:
          break
outputFile.close()
inputFile.close()
Then I created package that calls the procedure with the desired options. It still needs some work, but I think it will get the job done for now.
Any advice or corrections from the ODI gurus out there?

Similar Messages

  • Convert EBCDIC to ASCII and ASCII to EBCDIC in PI7.0 SP14

    Wea re going to be implementing PI7.0 SP14.
    I am writing the technical specification for an inbound/outbound interface into/out of ECC 6.0!
    I need to convert the File that is created out of SAP into EBCDIC in PI and for the inbound convert the file from EBCDIC into ASCII for import into ECC.
    I have more than one way to this...
    The ways I have found so far are:
    Use MessageTransformBean, use TextCodepageConversionBean, XmlAnonymizerBean, using the File Encoding field on the File/FTP Adapter, XSLT mapping or Java mapping!
    I have checked the OSS Note 821267, but this doesn't help.
    I am sure all these methods have pros and cons...
    What would be the most efficient method of changing this?  It will be running hourly and have upto 6000 entries an hour - each way!

    Hi Barry,
    I think the most efficient way in my thinking is XSLT and Java mapping.
    For java mapping u just need to get thye jar file.I believe that the encoding cp285 / cp500 is EBCIDIC. Try printing
    byte [] msg = .. // whatever
    System.out.println(new String(msg, "cp285"));
    if you get an exception saying Cp285 is unknown you may need an international version of the JRE, depends on the version you're using.
    Also u can use this in reverse.
    Please see this post:
    Re: Handling Packed decimals in XI
    regards
    Aashish Sinha
    Edited by: Aashish Sinha on Mar 25, 2008 6:07 PM

  • Convert EBCDIC to ASCII

    Hi all,
    We are using XI 3.0 SP 10 and I have a scenario where I only need to retrieve a file (via FTP) and deliver it to a file share inhouse. There is no need for any mappings etc. But the file Iam retrieving is in EBCDIC and I would need to convert this into ASCII when delivering to fileshare. I have set up the communication channels and this works fine. But what would be the easiest way to convert the EBCDIC file to ASCII?
    Regards,
    Fredrik

    Hi Fredrik,
      There is an alternate way of acehiving the same using a java program in the operatingsystem command option  of File adapter.
    Steps:
    1. Write a java program to read EBCDIC file and convert into ASCII file(Using codepages).
    2.Create a jar for the above program and store it in a server directory.
    3.Write one shell script/batch file call the java program and send command line parameters as filenames.
    4.In XI File adapter -Operating system command use the Shellscript/Batch file name (Complete path)and give %F for filenames
      Eg. /usr/sap/serverdir/convert.sh %F %F
    For more details refer the following link:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">XI File adapter</a>
    Regards,
    Ananth

  • Convertion EBCDIC to ASCII

    Hi,
    I retrieved a message from AS400
    How to convert a EBCDIC Hexadecimal to ASCII String
    Where the message from AS400 is
    e2d64040d6f2f0f0f5f0f8f2f2f1f6f3f6f4f4f0f0f1f2f2020050822163644fc8e2c2c3f0f2f2f2
    Thanks

    I believe that the encoding cp285 is EBCIDIC. Try printing
    byte [] msg = .. // whatever
    System.out.println(new String(msg, "cp285"));

  • Convert EBCDIC to ASCII using sqlloader

    hi..
    i have .dat file which extract from mainframe in EBCDIC format n i have to load in table using sqlloader.
    here, my .ctl sample:
    AMTV2_RESERVE08 POSITION(857:861) DECIMAL(9,2),
    AMTV2_RESERVE09 POSITION(862:866) DECIMAL(9,2)
    here, my record layout
    10 IN4331A-AMTV2-RESERVE08
    PICTURE IS S9(7)V99
    USAGE IS COMP-3
    ELEMENT LENGTH IS 5
    POSITION IS 857
    10 IN4331A-AMTV2-RESERVE09
    PICTURE IS S9(7)V99
    USAGE IS COMP-3
    ELEMENT LENGTH IS 5
    POSITION IS 862
    when i run the sqlloader, i got this error:
    Invalid packed decimal nibble.
    what must i do?
    thanks

    i'm using this
    load data
    characterset we8ebcdic500
    infile '/xxxxx/abc.dat
    "fix 866"
    replace
    into table A
    TRAILING NULLCOLS
    AMTV2_RESERVE08 POSITION(857:861) DECIMAL(9,2),
    AMTV2_RESERVE09 POSITION(862:866) DECIMAL(9,2)
    i'm using windows OS and using PUTTY to run this sqlloader.
    but, i still have "Invalid packed decimal nibble" errors.. whats the prob with my .ctl file actually?

  • Problem convertting certain extended ascii characters

    I'm having problems with the extended ascii characters in the range 128-159. I'm working with SQL server environment using java. I originally had problems with characters in the range 128-159 when I did a 'select char_col from my_table' I always get junk when I try to retreive it from the ResultSet using the code 'String str = rs.getString(1)'. For example char_col would have the ascii character (in hex) '0x83' but when I retrieved it from the database, my str equaled '0x192'. I'm aware there is a gap in the range 128-159 in ISO-8859-1 charset. I've tracked the problem to be a charset issue converting the extended ascii characters in ISO-8859-1 into java's unicode charset.
    I looked on the forum and it said to try to specify the charset when I retreived it from the resultset so I did 'String str = new String(rs.getBytes(), "ISO-8859-1")' and it was able to read the characters 128-159 correctly except for five characters (129, 141, 143, 144, 157). These characters always returned the character 63 or 0x3f. Does anyone who what's happening here? How come these characters didn't work? Is there a workaround this? I need to use only use java and its default charsets and I don't want to switch to the windows Cp1252 charset cuz I'm using the java code in a unix environment as well.
    thanks.
    -B

    Normally your JDBC driver should understand the charset used in the database, and it should use that charset to produce a correct value for the result of getString(). However it does sometimes happen that the database is created by programs in some other language that ignore the database's charset and do their own encoding, bypassing the database's facilities. It is often difficult to deal with that problem, because the custodians of those other programs don't have a problem, everything is consistent for them, and they will not allow you to "repair" the database.
    I don't mean to say that really is your problem, it is a possibility though. You are using an SQL Server JDBC driver, aren't you? Does its connection URL allow you to specify the charset? If so, try specifying that SQL-Latin1 thing and see if it works.

  • Convert JMS Headers from EBCDIC to ASCII when using JMS Bridge (WLS - WMQ)

    I have a Java app on Weblogic 11g using a Message Bridge to talk JMS with IBM Websphere MQ. The MQ server is running on IBM z/OS platform which uses EBCDIC encoding. I need to use the Weblogic message selector feature to filter messages on the bridge coming from Websphere MQ. But the JMS Headers of MSGs posted by WMQ are in EBCDIC format. How can I instruct MQ to convert the msg headers to ASCII before put on the bridge? Is there any flag on bindings config file? Or can I set some WMQ specific header before sending the msg on WLS side?
    Thanks in advance.

    Hi,
    Such option is not possible in weblogic but I think this property will help you with in MQ.
    Property - Convert EBCDIC newline
    Description - EBCDIC code pages contain a new line (NL) character that is not supported by the ASCII code pages (although some ISO variants of ASCII contain an equivalent). If messages are sent from a system that uses EBCDIC code pages (for example, a z/OS system) to a system that uses ASCII, you can control how the EBCDIC newline character is converted into ASCII format.
    The default value is NL_TO_LF, which means that the EBCDIC NL character (X'15') is converted to the ASCII line feed character LF (X'0A') for all EBCDIC to ASCII conversions. To convert the EBCDIC NL character according to the conversion tables on your operating system, click TABLE. Note that the results of a TABLE conversion can vary from platform to platform and from language to language; even on the same platform the results might vary if you use different coded character set identifiers (CCSIDs). To convert ISO CCSIDs using the TABLE method and use the NL_TO_LF method for all other CCSIDs, click ISO.
    Registry Stanza Key - ConvEBCDICNewline
    Also, the MQSeries (not MQSC) adapter provides the data conversion property may handle this conversion as well.
    Regards,
    Kal

  • Importing COBOL copybook into OSB & converting it to ASCII

    Hi,
    I want to import a COBOL copybook(.cpy/.copy file) into OSB.
    Based on that copybook, there is an EBCDIC file which I want to convert into an ASCII file.
    I used Format Builder to import the copybook, but it does not show any indication whether the copybook got imported or not.
    Please help... this is urgent..

    There was a problem with the copybook... so it was not imported.
    The corrected copybook got imported perfectly.

  • Two Spaces being converted to from ascii 32,32 to ascii 160,32

    Two Spaces being converted to from ascii 32,32 to ascii 160,32 when the page is
    loaded by the browser.
    This problem is exhibited when viewing an address page in personal data that contains
    two spaces in the address field. i.e.. APT102- 102 Elm St.
    We put debug traces in to display the ascii character values of the spaces before
    and after the record is brought up. This debug showed that the two spaces change
    from
    Before:      space,space or ASCII(32),ASCII(32)
    After:      ASCII(160) ASCII(32)
    This is causing the application to display a record change warning. This occurs
    on IE 5.5, 6.0, Netscape 6, but DOES NOT occur using the Opera 6 browser. For
    what it's worth, the database is Non-unicode.

    Forgot to add:
    This is WEBLOGIC SERVER 5.1 sp 9 running on Win2k

  • How to convert tdms to ascii files?

    Hello,
    I need to convert *.tdms files to an ascii file.  I have 16 channels and scalling coefficient information in the tdms file, With the TDMS-Image Viewer i can see the 1-D array waveform perfectly, but I cant write it to an ascii file. When I use a signalexpress.vi or the spreetsheat.vi for writing an LVM/ascii file,  information gets lost. (Red symbol at INPUT!!!!)
    Please answer me, because I dont have lots of experience with labview and an ascii file is more easier to handle for me! I found only export to matlab and exel, but i just want it in an ascii file.  Reading the tdms and opening it is no problem, but connecting the right blocks to the 1D array waveform without dataloss doesnt work.
    thank you for reading
    danny

    Thank you for reply,
    i have the new version 8.5.   With signalexpress.vis  i can do asciis but the red symbol (at input) is there so i dont want to get information lost.
    The tdms file has header information for scalling factors and unscalled data for 16 channels.
    so because tdms files are faster for writing i want to convert them to ascii with a Convertion Vi, but it seems that with an express vi he stops because it cant handle handle with the headerinformation.
    now i use the signalexess vi to write tdms data, before i did it manully by setting channel and group information.
    Please tell me if the red symbol AT input of a Signalexpress VI does matter?   its a 1D array wavefrom that goes in to the input.
    thank you for this discussion, i hope that i dont need to use the matlab import option for tdms!!
    greetings danny

  • EBCDIC to ASCII data conversion

    Hi,
    We have JDE system as source to bring data into BW. Howvever the format of the data is in EBCDIC and the data looks junk with out converting the same to ASCII.
    A quick research showed me that there are 3rd party tools to convert the data from EBCDIC to ASCII.
    Just wondering whether is there a function in BW system which takes care of this conversion?
    any thoughts? did any one come across this situation ?
    Inputs appreciated.
    Regards

    Hi
    Thanks for your response.
    Now where this class has to be applied ?...
    what does exactly this class do? can you share some insights on this ?
    Thanks

  • GUIA Conversion EBCDIC to ASCII

    Dear Gurus!!
    I'm needing a manual or guide of the conversión EBCDIC to ASCII in the V5R3M0 iSeries. i570.
    Can you help me?
    Best Regards.
    Luis

    Hi Morga,
    it has nothing to do with the OS release. You can stay on EBCDIC because of that as you found out.
    But:
    All release newer than 4.6D are in ASCII and UNICODE ONLY!
    => If you want to upgrade to e.g. ECC 6.0, you MUST convert to ASCII first ...
    hope this helps,
    Regards
    Volker Gueldenpfennig, consolut.gmbh
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

  • Convert char to ascii code and vice versa

    HI
    Is there any function module to convert char to ascii code and vice versa.
    Thanks in advance

    Hi,
    be careful if you have unicode running in your system. URL_ASCII_CODE_GET is platform-dependent so it will return the internal HERX representation of the character in your system - which is hopefully and in most cases ASCII.
    Under unicode, we use double-byte characters here. I tried this function and the result CHAR_CODE is '00' regardless what character I specify for TRANS_CHAR. But the coding is so simple I corrected resultig in this sample code:
    [P]
    convert p_form to ASCII (internal) representation
      DATA:
        l_ofs TYPE syfdpos,
        l_len TYPE sy-linsz,
        l_ascii TYPE i.
      FIELD-SYMBOLS:
        <x> TYPE x.
      l_len = STRLEN( p_ascii ).
      DO l_len TIMES.
        l_ofs = sy-index - 1.
        ASSIGN p_ascii+l_ofs(1) TO <x> CASTING.
        l_ascii = <x>.
        WRITE: l_ascii.
      ENDDO.
    [/P]
    Here, for each character of string p_ascii, the internal (ASCII) representation is determined and written to the output list.
    Regards,
    Clemens

  • Problem in converting Spool Request into PDF format

    Hi,
      I am facing problem to convert spool request (which store output of sap script) in to PDF format. Actually I have converted it with function module 'CONVERT_OTFSPOOLJOB_2_PDF' and it is working properly but the problem occurs where the BOLD fonts are used. I am unable to see the Text/Address where i have used Bold Font in script (PDF FORMAT). Even though in (SPO1) spool request shows every thing perfectly (along with Bold Font). It will great if you could suggest me something.
    Thanks,
    Pradeep

    Hi Pradeep,
    Use ,
    Closing the Sapscript, we save data (OTF) in a table
    CALL FUNCTION 'CLOSE_FORM'
    TABLES
    otfdata = t_otfdata
    EXCEPTIONS
    unopened = 1
    bad_pageformat_for_print = 2
    send_error = 3
    spool_error = 4
    OTHERS = 5.
    DATA: BEGIN OF t_otfdata2 OCCURS 0.
    INCLUDE STRUCTURE solisti1.
    DATA: END OF t_otfdata2.
    Move OTF data to another table with lenght 255
    LOOP AT t_otfdata.
    CONCATENATE t_otfdata-tdprintcom t_otfdata-tdprintpar INTO t_otfdata2.
    APPEND t_otfdata2.
    ENDLOOP.
    Convert OTF format to PDF
    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
    EXPORTING
    format_src = 'OTF'
    format_dst = 'PDF'
    devtype = 'PRINTER'
    FUNCPARA =
    len_in = len_in
    IMPORTING
    len_out = len_out
    TABLES
    content_in = t_otfdata2
    content_out = t_pdfdata
    EXCEPTIONS
    err_conv_failed = 1
    OTHERS = 2.
    Have a look at Progs. RSTXPDF4 and RSTXPDFT2 for converting the Spool to PDF.
    Regards,
    Raj
    Message was edited by: Rajasekhar Dinavahi
    Message was edited by: Rajasekhar Dinavahi

  • Problem in converting Spool to PDF file, having non-English characters

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

    Hi All,
            I have problem in converting Spool to PDF format.
    Scenario : I have a spool which has non-English characters. I am using CONVERT_ABAPSPOOLJOB_2_PDF  FM to perform conversion. But my output is having junk values( ie # ) for non-English characters. Any pointers to solve this issue will be appreciated.
    I even tried with report RSTXPDFT4 , it also gives me the same junk characters.
    Regards,
    Navin.

Maybe you are looking for

  • Mixing memory size

    Is it possible to mix different memory module sizes in an iMac 2010¿ I currently got the standard 2x2gb installed, but would like to add 2x4gb, making the total 12GB. Is this possible?

  • Webutil_host closing command prompt

    I am using this command in my form: webutil_host.nonblocking('cmd /c "' || v_file_name || '" && exit'); I want to be able to open the WORD/PDF/EXCEL, etc. file and close the Command Prompt as well. Currently, the document will display properly but th

  • How do I fix my homepage for Internet Explorer use, when using dreamweaver?

    Hi, I have recently created my first two webpages, and they looked like they were working when I was using Firefox. But when using Internet Explorer one of the pages drop the text down to an area of the screen where it's impossible to read it. Can so

  • Creating PDF from scan

    What are steps for getting OCR of scanned document so I can edit it? After scanning document, it opens in Acrobat but doesn't seem to be editable, only comment-able. How can I get document to be a mix of text and suporting images that I can edit, cha

  • [svn:fx-3.x] 16736: 3.6 DataGrid Bugs SDK-25886:  Fix ASDoc

    Revision: 16736 Revision: 16736 Author:   [email protected] Date:     2010-06-29 22:51:05 -0700 (Tue, 29 Jun 2010) Log Message: 3.6 DataGrid Bugs SDK-25886:  Fix ASDoc SDK-25481: reset hasComplexFieldName if necessary SDK-26477: fix logic for lockedR