Ebcdic to ascii file translation woes

I am trying to convert an ebcdic file into an ascii file but i am running into some difficulties.
The translation works fine, but it outputs everything onto one line when opened up in notepad on NT, with a symbol "ٱ" where a new line should be. When the same file is pasted into WordPad these sybols are interpreted into new lines.
Is there a way i can get the sybols replaced by new lines when opened up in Notepad?
import java.io.*;
class FileReaderDemo2
     public static void main (String args[])
          try
               //create and input stream reader froman ebcdic file                    
               FileInputStream inputStream = new FileInputStream ("input.ebc");
               //convert from ebcidic to unicode
               InputStreamReader inputReader = new InputStreamReader(inputStream,"Cp500");
               //attach a buffer to it
               BufferedReader buffReader = new BufferedReader (inputReader);
               System.out.println("Character Encoding is: " + inputReader.getEncoding());          
               //output file in ascii Cp1252 from unicode
               OutputStreamWriter outWriter = new OutputStreamWriter(new FileOutputStream("Output2.txt"),"Cp1252");
               String str = null;
               while ((str = buffReader.readLine()) !=null)
                    outWriter.write(str +"\n");
               inputReader.close();
               inputStream.close();
               outWriter.close();
          catch (Exception e)
               System.out.println("Exception: " + e);

Thanks for that.
I need to do the reverse now, so i have a ascii file i need to convert to ebcidic. Once again the conversion works ok but the output is all on one line.
I've tried
outWriter.write(str + "\n");
and
outWriter.write(str + "\r\n");
and
outWriter.write(str + System.getProperty("line.separator"));
But none of them seem to work.

Similar Messages

  • 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

  • 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

  • EBCDIC to ASCII conversion

    Hello experts,
    i'm performing EBCDIC to ASCII  conversion in our system and the export (command R3SETUP dbextr.r3s) terminates with the error :
    EXP) TABLE: "MCDYNTYPEN"
    (EXP) TABLE: "MCDYNUM"
    DbSl Trace: Error -904 in function exec_cached_fetch
    (EXP) ERROR: DbSlExeRead: rc = 99, table "MCHA"
         (SQL error -904)
    error message returned by DbSl:
    DbSl Trace: SQL error -904 with reason code 13
    Resource limit exceeded. Job=323987/DEVCPC/R3LOAD
    #STOP: 20100416175601
    Thank you,

    Once more the installation stopped with error...
    ERROR 2010-07-07 17:33:50 DBR3LOADEXEC_IND_DB4ASCII R3loadPrepare:0
    Child exited with error: rc = 2                                
    child_pid = 3                                                  
    See logfile SAPAPPL0.log for further information
    ERROR 2010-07-07 17:34:33 DBR3LOADEXEC_IND_DB4ASCII R3loadPrepare:0 
    Child exited with error: rc = 2                                 
    child_pid = 3                                                   
    See logfile SAPAPPL1_10.log for further information
    .ERROR 2010-07-07 17:36:01 DBR3LOADEXEC_IND_DB4ASCII R3loadPrepare:0
    Processes started: 46                                          
    Ended with error:  2                                           
    load tool ended with error.                                    
    See above SAP*.log errors.
    Error: Can not unlock the LogWriter. 
    Possible reasons:                                                                   
    No permissions to set the lock             
    Error: Can not lock the LogWriter.                                  
    Possible reasons:                                                   
    No permissions to set the lock                                      
    Error: Can not unlock the LogWriter.                                
    ERROR 2010-07-07 17:36:04 DBR3LOADEXEC_IND_DB4ASCII InstallationDo:0
    Phase failed.
    The message in "SAPAPPL0.log" is that
    "(IMP) ERROR: SQL statement failed: DROP TABLE "MCHA"
    MCHA in *LIBL not table, view, or physical file.
    " and in "SAPAPPL1_10.log" is
    "#Trying to create primary key "S602+0"
    (IMP) ERROR: CREATE statement failed for object "S602"
         (ALTER TABLE R3DEVDATA/"S602" ADD CONSTRAINT "S602+0" PRIMARY KEY ( "MANDT", "SSOUR", "VRSIO", "SPMON", "SPTAG", "SPWOC", "SPBUP", "VKORG", "VTWEG", "ZZIDIWTIS", "PRODH", "MATNR", "WERKS"  ))
    DbSlExecute: rc = 99
    (SQL error -603)
    error message returned by DbSl:
    Unique index cannot be created because of duplicate keys. "

  • 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

  • Load save panel ascii-file

    I would like to have a vi which creates a human
    readable ascii-file from any vi's front panel.
    If possible with the option to load it back into
    the vi. This way a situation can be saved as kind of a version. Also using the same settings in another vi could be handy.
    I have made a vi which makes creates a file containing control names, flattened data and typedefs of the controls, but it's binary !
    Is there a way to translate these codes to uman readable code ?
    This would bring me closer to the solution.

    Therefor you can use the ini file vi's. You can create a new section for
    each control and assign the informations (name, flatten data) with
    different keys like:
    [Control_01]
    Name=...
    FlattenData=...
    [Control_02]
    In some cases you are not able to see the real value, for instance the
    flatten data. Just try it out.
    Henrik
    bruyn schrieb:
    >
    > I would like to have a vi which creates a human
    > readable ascii-file from any vi's front panel.
    > If possible with the option to load it back into
    > the vi. This way a situation can be saved as kind of a version. Also
    > using the same settings in another vi could be handy.
    > I have made a vi which makes creates a file containing control names,
    > flattened data and typedefs of the controls, but it's binary !
    > Is
    there a way to translate these codes to uman readable code ?
    > This would bring me closer to the solution.

  • Media Encoder CC 2014.0.1 error on install: I can't unpack the downloaded files (translation).

    I have troubles with the latest update of Media Encoder CC (2014). I get an error which says: I can't unpack the downloaded files (translated from Dutch). Please try again. I try again, but it don't help. I have a MacPro early 2008 with Mavericks.
    =======================================
    Moderator moved thread from Premiere Pro forum to AME, and trimmed the title.

    Looks like one component in Media Encoder is either missing or corrupted somehow.
    Could you uninstall Adobe Media Encoder CC 2014 and please make sure all files are deleted after uninstall?  Then, please try re-installing it.

  • How can I extract a dates column from an ascii file

    I am extracting data from an ascii file and the rest of the data is extracted using read from spreadsheet, but the date appears as just the day e.g. 22 for 22nd, how can I get the date, format in ascii is e.g 22/04/2006, can I do this by specifying something at format of read from spreadsheet ? Cheers
    Emily

    Hi,
    I found the other day that there are instructions included inside the Read From Spreadsheet vi on how to modify it slightly to read strings rather than doubles.
    If you drop the Read From Spreadsheet  vi onto the block diagram and double click on it, you will open the front panel for the vi. If you then select the block diagram (for Read From Spreadsheet) you will see an 'instructions' frame below the main 'code', and the 3rd paragraph tells you how to modify the VI to read the spreadsheet as a set of strings rather then doubles. Save the vi as a new filename when you've edited it or you will overwrite the existing vi!
    Using the newly modified vi you can read in your entire spreadsheet, extract the dates as strings, then do any conversion necessary to the other columns of the sheet to change them into the types of value you require (eg doubles).
    I hope this helps.
    Mark
    Applications Engineer
    National Instruments

  • Deleting rows from a table matching values from an ascii file

    Hi All,
    I have an ASCII file with 12,000 lines. Each line represents a value (you may call this as bad data) that matches a database column value in table. I have to delete all the rows from a database table (~ 400,000 rows) where a column value matches the bad data value. Linux is the OS is where SQLPLUS client is installed and I can execure any SQL queries from this Linux server. Oracle DB server is 10g.
    Any input on how to do this will be helpfull to me. I am not a database programmer so if any details will be appreciated.
    Thanks

    Hi,
    That's going to be very slow (among other problems) if you don't have the bad data in a table. An index-organized table would probably be best.
    Assuming the data data are uinique strings, up to 30 characters long, and that you don't need any other columns, you can create a table like this:
    CREATE TABLE  bad_data
    (   bad_txt    VARCHAR (30)
    ,  CONSTRAINT  bad_data_pk  PRIMARY KEY (bad_txt)
    ) ORGANIZATION INDEX;SQL*Loader is one way of getting the data from the file (doesn't have to be on the database server; it can be on your client machine) into the table.
    Once you have a table, actually removing the rows from the big table might be as simple as:
    DELETE  big_table
    WHERE   column_a  IN
            (   SELECT  bad_txt
                FROM    bad_data
    ;

  • Please help me in reading the ascii file in encoded format

    hi ,
    iam trying to read the ascii file and i need to encode the text file, can u suggest me what arre the different methods are availble for me to encode the text file, please suggest me which is the effiecient method tto use?

    This question has been answered before, please search the forums in future.
    You could do something like this, it probably not the most efficient though.
    If you don't need to do it in code then the native2ascii does this conversion see: http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/native2ascii.html
            public static void convert(String vsFile) throws IOException
              File f = new File(vsFile);
              FileReader fr = new FileReader(f);
              char[] buf;
              int bytesRead = 0;
              int startAt = 0;
              String content = "";
              do
                   buf = new char[512];
                   bytesRead = fr.read(buf, 0, 512);
                   startAt += bytesRead;
                   String tmp = new String(buf);
                   content += tmp;
              while (bytesRead == 512);
              FileOutputStream fout = new FileOutputStream(f);
              OutputStreamWriter out = new OutputStreamWriter(fout, "UTF-8");
              out.write(content.trim());
              out.flush();
              out.close();
         }

  • Problem with non-ASCII file name in content disposition header

    Hi All,
    I am facing some problems with the non-ASCII file name incase of content-disposition header. I read from the RFC 2183 that if the file name contains non-ASCII characters then the same should be encoded before sending to browser. I did the same but realized 2 problems:
    1. The name of the file is truncated in case the file name is slightly long for e.g. �����������j�b�g��������������������������.txt
    2. Also when the same file is opened in notepad, the title is showing encoded name %E6%9C%80%E4%B8%8A%E4%BD%8D.....
    Overall, I feel that the browser is not understanding or responding to the encoded header values.
    Is there any solution to this problem? I am using Microsoft IE 6.0.
    The code snippet is given below:
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              String fileName = "�����������j�b�g��������������������������.txt";          
              fileName = URLEncoder.encode(fileName, "UTF-8");
              resp.setCharacterEncoding("UTF-8");
              resp.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
              resp.setContentType("application/download-binary");
              String s = "This is inside txt file";
              resp.getOutputStream().write(s.getBytes("UTF-8"));
              return;
         }Any help or pointer would be highly appreciated.
    Thanks and Regards,
    Ashish

    The MIME standards for non-ASCII filenames are not widely implemented.
    Many mailers use an ad hoc method for encoding filenames. JavaMail
    supports both methods, but you need to set properties, such as the
    mail.mime.encodefilename property. See the JavaMail javadocs for
    the javax.mail.internet package.

  • How do i create a list of frequencies +/- a peak output as ascii file?

    I have an VI set up that reads in from a Spectrum Analyzer and searches for the peaks and outputs them along with there amplitudes as an ASCII file.
    A Macro has been created in Excel that reads the ASCII file and creates a list of 5  frequencies +/- the peak frequencies above a threshold to be tested later.  The problem is that it has some frequencies
    created more than once.
    Is it possible to create this list in the VI that would filter the list and then output it to excel to be printed later?

    ChrisKalina wrote:
    I have an VI set up that reads in from a Spectrum Analyzer and searches for the peaks and outputs them along with there amplitudes as an ASCII file.
    A Macro has been created in Excel that reads the ASCII file and creates a list of 5  frequencies +/- the peak frequencies above a threshold to be tested later.  The problem is that it has some frequencies
    created more than once.
    Is it possible to create this list in the VI that would filter the list and then output it to excel to be printed later?
    Of course it is possible to do this.  What have you tried so far?
    One problem you will have, though, is that LV 5 is such an ancient version, many people on the forums will have trouble being able to open your file, and almost no one will have the means to save back that far.  So you may have a hard time getting help.

  • Can Signal Express prompt the user for the next ascii file name?

    I am using the following to collect data from Thermocouples and Strain Guages in our plant.  It allows me to plt data every second, while recording only every 3 seconds to cut down the file size.
    Big Loop- 
    Small Loop- 
          Conitional repeat...
          DAQmx Aquire...
          Statistics (mean) Temp...
          Statistics (mean) Press...
          Current Iteration...
    End Small Loop-
    Save to ASCII/LVM
    The problem is that I have to configure the save step as "overwrite once, then append" so I get a single file each time the project runs.  How can I get Signal Express to either prompt the user for a new file name with each run or have the ascii file saved into the log directory for that run.  As it stands now, the file gets overwritten with each new project run.
    Thank you.
    new user

    Hi crawlejg,
    You can set signal express to increment the file being created each time.  But if you are looking for 1 new file each time the project runs you will have to use LabVIEW as this advanced functionality is not available in Signal Express.  If you need help getting this to work in LabVIEW or have any other questions please feel free to ask!
    Sincerely,
    Jason Daming
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • Mapping and loading  single ASCII file into multiple tables in ODI

    We get an ASCII file that contains several different transactions (records) and I need to validate and map each record to different table in the target database using Oracle Data Integrator tool. Is it possible ? If so, how and how difficult it is ?
    I would appreciate a quick response.
    Thanks,
    Ram

    Hi Madha,
    Using Demo version, we are trying to load data from ASCII file. When trying to execute, we are getting the following error:
    7000 : null : com.sunopsis.jdbc.driver.file.a.icom.sunopsis.jdbc.driver.file.a.i
    at com.sunopsis.jdbc.driver.file.a.f.getColumnClassName(f,java)
    at com.sunopsis.sql.e.a(e.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
    The file has all text fields and no date fields. we made sure that there is data for all fields being loaded.
    Question is whether there is any problem in creating data in the Demo database which cameup with installation?
    I mean, do we need to create any privileges to insert/add/delete ? We are running this as user SUPVERVISOR .
    I appreciate if you can respond to this.
    thanks,
    Ram

  • Making an ASCII file into a text file

    Hi-
    I am trying to read the lines of an ASCII file as Strings and write them to a new text file. Eventually I will modify the info in the lines, but for now I'm just trying to get the flow from one file to another. I can't figure out how to write a String to a new file. Below is the code that I've written so far, followed by the error that i get when I run it (it compiles fine). One problem I see is that FileWriters are made to write characters, but I want to write Strings to a new file. How do I get around this?
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    class Delimiter {
    public static void main (String[] args) throws IOException {
    try {
    File inputFile=new File("test.asc");
    File outputFile=new File(test.txt");
    BufferedReader in=new BufferedReader(new FileReader(inputFile));
    BufferedWriter out=new BufferedWriter(new FileWriter(outputFile));
    String line=" ";
    while (line != null) {
    line=in.readLine();
    out.write(line);
    out.newLine();
    in.close();
    out.close();
    } catch (IOException e) {
    ERROR:
    Exception in thread "main" java.lang.NullPointerException
    at java.io.Writer.write(Unknown Source)
    at Delimiter.main(Delimiter.java:23)

    sorry, I responded too quickly. I put out.write(null);
    just before the in.close(); statement and got an error
    saying that command is ambiguous b/c write() could
    belong to multiple classes. did you mean that I should
    put it in the while loop?I didn't mean for you to put
    out.write(null);
    in your code. I meant to point out that when 'line' is null, the problem is that you are passing a null to the out.write() method. That is bad. Don't do that. Use the above. It will test for null before doing the write().

Maybe you are looking for

  • Message: Service Apple Mobile Device  failed to start when installing Itunes.

    When downloading a new version of Itunes I receive a message "Service Apple Mobile Device" failed to start. I have read the articles on how to start Apple Mobile Device.  But when I go to services, Apple Mobile Device is not listed. So I cannot start

  • Downloading Smartforms Output into MS Word format

    Hi, Is there any way to download Smartform Output data in to MS Word.?...like the way we download Smartform data into PDF format. is there any FM available to handle this like CONVERT_OTF, CONVERT_OTF_2_PDF in case of PDF. Full points for useful answ

  • Webforms Calendar

    I cannot get a designer-developed form to display the calendar feature in webforms. Can anyone offer assistance? Thank you.

  • Flash Player flickering in IE8 on pages with Flash

    We're having a problem with Flash 10.1 on an Windows XP Pro 32bit machine and all pages with associated flash content flickering when you scroll the page.  This has been happening with the most recent version as well as older versions. Machine: Dell

  • Portege M300 hangs after "Windows shuts down" comes up on the screen

    The computer hangs after "Windows shuts down" comes up on the screen. The same happens in hibernation mode. I have to turn off the computer by holding the on/off button. I have updated my bios, installed all windows updates that are available and don