File writing in EBCDIC format

Hi all,
Is it possible to write in EBCDIC format in a file?if so,
Pls provide me a sample code..

Haven't looked at it, but it's possible that
OutputStreamWriter supports EBCDIC
as in
PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream( args[0] ), "EBCDIC" ));
or perhaps some other constant. It's also possible that it doesn't.
If not, you should examine the source code for OutputStreamWriter and write your own class that does what it does, only for EBCDIC. I don't recall that there's anyway to extend the built in OutputStreamWriter with new encodings, which seems like a silly thing for sun to have done, if that is the case.

Similar Messages

  • Comparison of two files in EBCDIC format

    Hi boarders..
    I have a file which is there in ASCII format. I convert it to EBCDIC format using the below code
    import java.io.*;
    public class DcollType {
    static String readInput() {
        StringBuffer buffer = new StringBuffer();
        try {
         FileInputStream fis = new FileInputStream("CLR812AX_TST5000.txt");
         InputStreamReader isr = new InputStreamReader(fis, "ASCII") ;
         Reader in = new BufferedReader(isr);
         int ch;
         while ((ch = in.read()) > -1) {
              buffer.append((char)ch);
         in.close();
         return buffer.toString();
        } catch (IOException e) {
         e.printStackTrace();
         return null;
    static void writeOutput(String str) {
        try {
         FileOutputStream fos = new FileOutputStream("ascii.bin");;
         Writer out = new OutputStreamWriter(fos, "Cp1047" );
         out.write(str);
         out.close();
        } catch (IOException e) {
         e.printStackTrace();
    public static void main(String[] args){
    String inputstr=readInput();
    writeOutput(inputstr);
      Now once i produce this file, i need to compare this file, with another EBCDIC file.
    This second EBCDIC file is got by converting the original ASCII file using Mainframe emulator tool.
    I want the boarders help in wrting a code which will help me in comparing tw0 EBCDIC file's content byte by byte..

    Eh? Just compare them. Since you're just comparing the bytes, you don't need a java.io.Reader; you just need a java.io.InputStream. (Or two, really.)
    You've already shown you can handle this...just open two input streams, one for each file, and compare each byte, byte-by-byte. As soon as two bytes are not equal, you've shown that they're not the same. If you reach the end of both the files and all the bytes are the same, then they have identical contents (regardless of encoding).
    Maybe you're being thrown by the encoding? It's really not relevant if you're just checking to see if the bytes are the same.

  • Writing files in UTF-8 format

    Hi,
    Our system is unicode enable and I want to write a file in UTF-8 format.
    I'tried  the following syntax.
    OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
    and OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING default
    But when I check the file, it is in ANSI format. Is there a way we can force the system to write it in UTF-8 format?
    Thanks,
    Ramesh

    Hi Ramesh,
    You could try to use the following coding:
    *& Report ZUS_SDN_UC_XML_TO_UTF8_TRANSF
    REPORT zus_sdn_uc_xml_to_utf8_transf.
    define local data
    CONSTANTS:
    gc_encoding TYPE string VALUE 'UTF-8'.
    DATA:
    gd_result type string,
    go_ixml TYPE REF TO if_ixml,
    go_stream_factory TYPE REF TO if_ixml_stream_factory,
    go_encoding TYPE REF TO if_ixml_encoding,
    go_resstream TYPE REF TO if_ixml_ostream.
    DATA:
    gt_knb1 TYPE STANDARD TABLE OF knb1,
    gd_xml TYPE string,
    gt_xml TYPE TABLE OF string.
    START-OF-SELECTION.
    SELECT * FROM knb1 INTO TABLE gt_knb1 UP TO 10 ROWS
    WHERE bukrs = '1000'.
    go_ixml = cl_ixml=>create( ).
    go_stream_factory = go_ixml->create_stream_factory( ).
    go_encoding = go_ixml->create_encoding( character_set = gc_encoding
    byte_order = 0 ).
    go_resstream =
    go_stream_factory->create_ostream_cstring( gd_result ).
    CALL METHOD go_resstream->set_encoding
    EXPORTING
    encoding = go_encoding.
    XML Transformieren
    CALL TRANSFORMATION id_indent
    SOURCE itab = gt_knb1
    RESULT XML go_resstream.
    APPEND gd_result TO gt_xml.
    CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
    BIN_FILESIZE =
    filename = 'C:\temp\xml_to_utf8.txt'
    FILETYPE = 'ASC'
    APPEND = SPACE
    WRITE_FIELD_SEPARATOR = SPACE
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = SPACE
    WRITE_LF = 'X'
    COL_SELECT = SPACE
    COL_SELECT_MASK = SPACE
    DAT_MODE = SPACE
    CONFIRM_OVERWRITE = SPACE
    NO_AUTH_CHECK = SPACE
    CODEPAGE = SPACE
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = SPACE
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    IMPORTING
    FILELENGTH =
    CHANGING
    data_tab = gt_xml
    EXCEPTIONS
    file_write_error = 1
    no_batch = 2
    gui_refuse_filetransfer = 3
    invalid_type = 4
    no_authority = 5
    unknown_error = 6
    header_not_allowed = 7
    separator_not_allowed = 8
    filesize_not_allowed = 9
    header_too_long = 10
    dp_error_create = 11
    dp_error_send = 12
    dp_error_write = 13
    unknown_dp_error = 14
    access_denied = 15
    dp_out_of_memory = 16
    disk_full = 17
    dp_timeout = 18
    file_not_found = 19
    dataprovider_exception = 20
    control_flush_error = 21
    not_supported_by_gui = 22
    error_no_gui = 23
    OTHERS = 24.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    END-OF-SELECTION.
    However, I like to mention that the file created from out ECC 5.0 (6.40, non-Unicode) contains a special character between the XML header and the data part (when displayed using NotePad Editor):
    ...xml version="1.0" encoding="utf-8"?>[special character]<asx:abap xmlns:asx="http://www.sap.com/a...
    Using a HexEditor the special character (0x0A) is displayed as a dot.
    Also Check with FM - TREX_TEXT_TO_UTF8
    Regards,
    KK

  • How to covert EBCDIC format to ASCII in JMS Adapter??????????

    Hi All,
          I am developing one JMS to File scenario, in which JMS adapter will pick file which is in EBCDIC format from WebSphere MQ and send it to receiver file system by receiver file adapter. when i am trying this, i am getting file in EBCDIC format in receiver file system, but the file system is expecting data in ASCII format.
    Is there any options to encode the EBCDIC format to ASCII in Sender JMS Adapter or Receiver File Adapter.
    Thanks,
    Madhusudhan.

    Hi,
    It was Basis / Database / OS staff that configured this aspect of the connection, and I am afraid I do not have any more details.
    A Google search gave me the following from IBM Documentation on MQ Series:
    <a href="http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/ucli_pqcfm.html">http://publib.boulder.ibm.com/infocenter/wsphelp/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/ucli_pqcfm.html</a>
    <b>MQSeries queue connection factory settings for application clients</b>
    CCSID
    The coded character set identifier for use with the WebSphere MQ queue manager.
    This coded character set identifier (CCSID) must be one of the CCSIDs supported by WebSphere MQ.
    Data type  String 
    For more information about supported CCSIDs, and about converting between message data from one coded character set to another, see the WebSphere MQ System Administration and the WebSphere MQ Application Programming Reference books. These are available from the WebSphere MQ messaging multiplatform and platform-specific books Web pages; for example, at <a href="http://www-3.ibm.com/software/ts/mqseries/library/manualsa/manuals/platspecific.html">http://www-3.ibm.com/software/ts/mqseries/library/manualsa/manuals/platspecific.html</a> , the    IBM Publications Center , or from the WebSphere MQ collection kit, SK2T-0730.
    hope this may be of some help
    Andrew

  • Import a shape file to oracle spatial format within an oracle pl/sql proced

    hi,
    My task is to import an esri sde shape file to oracle sdo format within pl/sql procedure.
    i am using oracle 10g, arcgis 9 and arcsdo, geometry type is line, please anyone could help how can i achieve this task, would be very thankful
    Best Regards,

    There are no "in database" tools around that do this AFAIK. Most/all tools are external to the database and have to be invoked externally.
    If you created an external "batch file" that did the right processing, you would still have to work out how to execute this batch file from within Oracle. AFAIK the standard method is to use create custom code that uses DBMS_PIPE to communicate with the operating system to execute the batch file. DBAs hate this approach and it does require programming.
    The other method could be to write a trivial piece of Java that when passed the full path to the batch file executes the file. You would then load the compiled Java class into the Oracle JVM and then create a simple PL/SQL wrapper around it. I can't do it at the moment, but can come back with the code and instructions later on in the week.
    <SHAMELESS PLUG>
    As an aside (it seems appropriate to mention this now), I have been developing tools that do run inside the Oracle JVM an can export Oracle data (including sdo_geometry) to a number of formats:
    * xSV (ie comma separated, tab separated, any other single character)
    * Excel Spreadsheet
    * ESRI Shapefile (including the writing of the PRJ file using a user supplied PRJ string and also I write a MapInfo TAB file to "wrap" the shapefile).
    When exporting to xSV or Excel Spreadsheet one can chose to encode the SDO_GEOMETRY data as GML or WKT.
    (I am working on a KML exporter as well.)
    However, note that these tools EXPORT data and do not IMPORT data.
    The tools, currently are running in production at a customer site (tabbed shapefile export option) and work well. Export jobs are defined and given to the Oracle JOB or SCHEDULER and correctly run at the appropriate time writing the data to an operating system directory defined internally (with appropriate permissions) as an Oracle Directory object.
    I am now considering selling the exporter tool and am looking for testers. (The pricing of these tools will be exceedingly low.)
    </SHAMELESS PLUG>
    Now, while I hadn't planned to write any importer for a shapefile for my Exporter, I might consider it if you get stuck and can't find a satisfactory tool.
    regards
    Simon

  • Conversion from UTF  to EBCDIC format- Urgent

    I want to convert the data from UTF* format to EBCDIC format and create a flat file for the same. Is there any utility tools available in oracle. If not what are the other possibilities? pls help me.
    Thanks
    Krishnaraj

    Hi ,
    I am trying to convert the normal text data to EBCDIC. As we all know, there is a corresponding value for each normal character in ASCII/HEX/BINARY/EBCDIC etc.
    Using CONVERT I am able to see some data converted correctly but rest of hte accented characters not correctly.
    select convert('^', 'US7ASCII','EBCDIC' ) from dual;
    select convert(';' ,'WE8EBCDIC500','US7ASCII') from dual;
    ^ = ascii normal txt
    ; = corresponding ebcdic of ^
    Internally CONVERT function seems to be doing correct conversion but there is a problem wiht the actually new - to be replaced characters. SQLPLUS is not able to display all the characters correctly. For all the accented chars of "a", it shows plain english a, same wiht e , u etc.
    I would like to know is there anyone who knows what client side settings need to be done so that the CONVERT function output is displayed correctly on SQLPLUS.
    I am using Oracle 9i Rel 2
    NLS_LANG on my client (win XP) is set to AMERICAN_AMERICA.WE8MSWIN1252
    As seen in the CONVERT function, the correct charset is - 'WE8EBCDIC500'
    And the db params are as follows --
    ===========================================
    SQL> select * from NLS_DATABASE_PARAMETERS;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 9.2.0.1.0
    ===================================================
    Can anyone help me on this??
    Thanks in advance
    regards
    Abhivyakti,
    Pune, India

  • Can File Adpater read EBCDIC file on the sender side

    Hi ,
    I Have file to Proxy scenario and on the sender side I have EBCDIC file can file adpater can read it into normal text format can any one suggest me how to encode the file
    Thanks Inadvance
    Byee

    Hi ,
    Since my scenario is File to Proxy I need to send data to Proxy I cant send it in EBCDIC format ..... So I want data to bein normal text format........
    I am looking for it .........
    for EJB do you have any piece of code... that will be helpfull
    Thanks Inadvance....

  • I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I am not aware of a way except for photos that allows you to select multiple files in an email. I even checked settings in the Adobe Reader app, and it does not show that ability.

  • "Only files in Apple Loops format will be shown in the loop browser".

    I recorded a Drum loop from my Korg m50 workstation into logic pro 9.
    After recording i tried to import that loop into Apples loop library. After doing so i get this message.."Only files in Apple Loops format will be shown in the loop browser."
    What do i do?
    Please help.
    Thanks
    Rohan

    I've recently gotten this error when I try to drag an audio file into the loops library (to create an apple loop.)
    Comes along with Result Code=-43.
    I'm trying to quantize some rhythmic loops using flex, then turn them into apple loops for the library.
    My process:
    Take original audio.
    Flex it using slice mode.
    Bounce in place.
    Drag new region into Loops browser.
    Errors ensue.

  • I am trying DWF files to a PDF format but only half of my drawing is converting.  Can anyone help?  Is it a setting?  The original file is an autocad file.

    How do you convert AutoCAD DWF files to a PDF format.  These are blue prints and I was told by Adobe to use the Acrobat DC program so that's what I did but now I am only getting half of a drawing on a page.  Is this as simple as a setting?

    Hi subscription question,
    I've checked your account; it looks like you tried to place two separate orders this morning, but it doesn't appear that either went through. However, it does sound as though you've been able to convert a file successfully. What happens when you log in to your account at https://cloud.acrobat.com/files? Do you see your converted file there? All converted files are automatically stored in your online account, even when you convert from within Reader.
    Best,
    Sara

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • How to Save Pdf file in a particular format

    Hi Experts,
                        Can anybody tell me how to save a pdf file in a particular format,My requirement is i have a print button in webdynpro ,when ever user clicks on print ,adobe form is opened ,if user clicks on save .Form is saving with adobe form name .My requirement is it should be saved as ID NO.Date.Pdf  form lets Id is 0456 ,form should be saved as 0456.040614.pdf format, Thanks in Advance
    Regards
    Sandesh

    Hi Sandesh,
    Please provide the complete code from print & save button.
    Thanks & Regards,
    Balamurugan G

  • I could not transfer photos from iphone to macbook through iphoto. It is giving an error " could not be imported, file is in unrecognized format"

    I could not transfer photos from iphone to macbook through iphoto. It is giving an error " could not be imported, file is in unrecognized format"

    Did you look in iTunes?

  • Finder cannot open files in the "volume" format.

    I had to downgrade from the second Yosemite beta in order to run one of my applications for work that didn't run on Yosemite. I've successful reinstalled Mavericks to the chagrin of finder not working at all. Whenever I mount a DMG I get "Finder cannot open files in the “volume” format." Also, whenever I click to open a folder or a new window in finder, it just crashes and relaunches. I'm going to try to do a fresh install of Mavericks and recover from a backup. Let me know if you guys have faced this same issue and found a solution.
    I also had to regain admin privileges for my user which I have done successfully.

    I fixed my problem by installing Mavericks again. No need to fully restore.

  • Can I get files from a Mac formatted External Hard Drive onto a PC

    I have some old files on a mac formated external and wanted to know if there is anyway I could plug it into my pc and be able to access it. So far no dice. If there is a way to do it, I'd really appreciate knowing how. Thanks a lot.

    Install an application such as MacDrive onto Windows.
    (37079)

Maybe you are looking for

  • Audio gone after EyeTV Update

    I've just updated to EyeTV 2.3.2 (Everything was fine on 2.3.1) and now find there is no audio through the digital output on the iMac. If I unplug the connector from the digital out on the back of the computer then plug it back in while eyeTV is runn

  • Publishing error Can't create the file "shapeimage_3_link_1.png."

    I keep getting this publishing error when i try to publish my sites to .mac: "Can't create the file "shapeimage3_link1.png." The disk may be damaged, full, or you may not have sufficient access privileges." I don't know what this means or how to fix

  • With OS 10.6.7 update, iTunes 10.2.1 (1) crashes my MacbookAir

    After upgrading to the new version of OS X I opened up iTunes and then my entire system froze. I then found out that it only happened with Safari open with some Flash running. I uninstalled Flash and now the computer doesn't freeze anymore. Again, th

  • I do not want to be too picky here, but does anyone hear a hum from C2D?

    Ok, let's get this straight. I have been through the whine, and that is something to complain about. What I am talking about is a smaller noiser that can be heard when my computer is on my iCurve. I am not sure if it is just the angle it sits at when

  • N70 Has Frozen

    My Nokia N70 has frozen, I tried to upload a video via bluetooth and it asked me my phones name but its just frozen and none of the button will exit or anything, it won't turn off. what will i do?