Re: Code convert ascii to EBCDIC

At 09:06 PM 8/13/97 +0900, Isao Yamada wrote:
I am trying conversion ascii-to-EBCDIC conversion.You didn't mention the platform, but if it is Unix, I would just pipe the
input through the dd command. Even if this is a Win32 platform, I would
consider buying the Win95 toolkit from Ready-to-Run and using the dd
command in it.
=========================================================================
Thomas Mercer Hursh, Ph.D email: [email protected]
Computing Integrity, Inc. sales: 510-233-9329
550 Casey Drive - Cypress Point support: 510-233-9327
Point Richmond, CA 94801-3751 fax: 510-233-6950

Isao,
You can convert arbitrary binary data
using MemoryStream, ReadBinary(), pointers
and casting to convert simple binary types to the
type you require. Here is a partial code fragment
from some binary communications code we wrote
to give you the idea. Although it looks like
'C' in places it really is valid TOOL code.
buf : MemoryStream = new;
theHeader : MemoryStream = new;
theData : MemoryStream = new ;
tempData : BinaryData = new ;
countBytes : integer = 0 ;
tempcountBytes : integer = 0 ;
ConnId : ui2 = 0 ;
magicNumber : ui4 = 0x5aa50ff0 ;
p : pointer = nil;
buf.Open(accessMode = SP_AM_READ_WRITE);
theHeader.Open(accessMode = SP_AM_READ_WRITE);
// Read the header
theHeader.Flush() ;
theHeader.Seek( position = SP_RP_START ) ;
countBytes = 0 ;
// Parse theHeader here
theHeader.Seek( position = SP_RP_START ) ;
theHeader.ReadBinary( target = tempData, length = 4 ) ;
p = (pointer)(tempData.Value) ;
PacketLength = *(pointer to ui4)(p) ;
theHeader.ReadBinary( target = tempData, length = 1 ) ;
p = (pointer)(tempData.Value) ;
PacketType = *(pointer to ui1)(p) ;
theHeader.ReadBinary( target = tempData, length = 2 ) ;
p = (pointer)(tempData.Value) ;
PacketSeqNo = *(pointer to ui2)(p) ;
theHeader.ReadBinary( target = tempData, length = 2 ) ;
p = (pointer)(tempData.Value) ;
ConnId = *(pointer to ui2)(p) ;
theHeader.ReadBinary( target = tempData, length = 4 ) ;
p = (pointer)(tempData.Value) ;
magicNumber = *(pointer to ui4)(p) ;
if( magicNumber != 0x5aa50ff0 ) then
buf.Close() ;
theHeader.Close() ;
return FALSE ;
end if ;
[email protected]
MIME-Version: 1.0
Content-type: text/plain; charset=iso-2022-jp
Hi! Everyday I read some useful tips from this mailing-list.
I am trying conversion ascii-to-EBCDIC conversion.
I want to read binary-file, because EBCDIC code data come by floppy-disk.
But I can't read this file into TextData object.
(TextData Class have method to access by byte.)
I know that I can read binary-data into BinaryData object.
if I can access BinaryData class by byte or read binarydata into textdata.
Does anyone have good idea for this question?
thanks.
T.C.F.Co.Ltd.
Isao Yamada([email protected])
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
Reuters Ltd.

Similar Messages

  • Re: Code convert ascii to EBCDIC-thanks

    thanks alfred.
    Your hints is enable to make convert-program.
    method CodeConvertB.SJISToEBCDIC(copy input InData: Framework.BinaryData,
    copy output OutData: Framework.BinaryData,
    copy input Length: integer = 0)
    begin
    memIn : MemoryStream = new;
    memOut : MemoryStream = new;
    tmpIn : BinaryData = new;
    tmpOut : BinaryData = new;
    OutData = new;
    j : ui1;
    ic : char;
    oc : char;
    if Length = 0 then
    Length = InData.ActualSize;
    elseif Length > InData.ActualSize then
    Length = InData.ActualSize;
    end if;
    memIn.Open( SP_AM_READ, TRUE );
    memIn.UseData( (pointer to char)(InData.Value), Length );
    memIn.Seek( SP_RP_START );
    memOut.Open( SP_AM_READ_WRITE, TRUE );
    memOut.Seek( SP_RP_START );
    for i in 0 to Length - 1 do
    memIn.ReadBinary( tmpIn, 1 );
    ic = *( pointer to char )( tmpIn.Value );
    j = ic;
    oc = ToEBCDIC[j];-- Value is EBCDIC.Array is S-JIS(ASCII) order
    tmpOut.SetValue( &oc, 1 );
    memOut.WriteBinary( tmpOut, 1 );
    end for;
    memIn.Close();
    memOut.Flush();
    memOut.Seek( SP_RP_START );
    memOut.ReadBinary( OutData, Length );
    memOut.Close();
    return;
    end method;
    if someone want to use this complete-code, mail to me.
    thanks.
    T.C.F.Co.Ltd.
    Isao Yamada([email protected])

    thanks alfred.
    Your hints is enable to make convert-program.
    method CodeConvertB.SJISToEBCDIC(copy input InData: Framework.BinaryData,
    copy output OutData: Framework.BinaryData,
    copy input Length: integer = 0)
    begin
    memIn : MemoryStream = new;
    memOut : MemoryStream = new;
    tmpIn : BinaryData = new;
    tmpOut : BinaryData = new;
    OutData = new;
    j : ui1;
    ic : char;
    oc : char;
    if Length = 0 then
    Length = InData.ActualSize;
    elseif Length > InData.ActualSize then
    Length = InData.ActualSize;
    end if;
    memIn.Open( SP_AM_READ, TRUE );
    memIn.UseData( (pointer to char)(InData.Value), Length );
    memIn.Seek( SP_RP_START );
    memOut.Open( SP_AM_READ_WRITE, TRUE );
    memOut.Seek( SP_RP_START );
    for i in 0 to Length - 1 do
    memIn.ReadBinary( tmpIn, 1 );
    ic = *( pointer to char )( tmpIn.Value );
    j = ic;
    oc = ToEBCDIC[j];-- Value is EBCDIC.Array is S-JIS(ASCII) order
    tmpOut.SetValue( &oc, 1 );
    memOut.WriteBinary( tmpOut, 1 );
    end for;
    memIn.Close();
    memOut.Flush();
    memOut.Seek( SP_RP_START );
    memOut.ReadBinary( OutData, Length );
    memOut.Close();
    return;
    end method;
    if someone want to use this complete-code, mail to me.
    thanks.
    T.C.F.Co.Ltd.
    Isao Yamada([email protected])

  • Converting ASCII to EBCDIC and Packed Decimals as well

    Hi All,
    We have a requirement where data from a SAP system comes in ASCII format as  a flat file.PI needs to encode 4 fields in the packed decimals and rest of the fields in EBCDIC format before sending to mainframe system.
    When I use code page cp500 at the reciever file adapter level it encodes the entire file in EBCDIC format.
    However we want those 4 fields to be in packed decimals while sending to mainframe system.
    Could you please help me in figuring out a solution?
    Thanks,
    Sowmya

    Hi Sowmya
    Check this thread
    ASCII to EBCDIC packed decimal

  • ASCII to EBCDIC converter

    Hello everybody!
    I'm looking for a function module which converts ASCII text to EBCDIC. Unfortunately I couldn't find anything about this so far. It would be great if somebody could give me some information about.
    Thankyou!
    Best regards,
    Markus

    Hi Marcus,
    You don't need a Function Module; there is a ready ABAP command 'EBCDIC(x)' available.
    You will find more information here: [Converting ASCII to EBCDIC and vice-versa|http://www.sapdb.org/7.4/htmhelp/5e/0a41edba9d11d2a97100a0c9449261/frameset.htm]
    Also, check this link : [Standard include for converting ASCII / EBCDIC|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/converting-data-from-ascii-to-ebcdic-in-unicode-environment-420663]
    Hope this helps! Please let me know if you need anything else!!
    Cheers,
    Shailesh.

  • ASCII to EBCDIC

    Hello All,
    How can I convert ASCII to EBCDIC using PI? Any modules to be used in channel?
    Thanks,
    Regards,
    Naresh

    Hi,
    Please check below thread.. it mentions about the beans you can use.
    Convert EBCDIC to ASCII and ASCII to EBCDIC in PI7.0 SP14
    Regards,
    Deepak

  • HELP! Converting ascii to its decimal codes

    Does anyone know how to convert ascii code to its decimal equivalent? Is there a simple function that can do this?
    Thanks for any help!!

    Yes there is.
    String whatever = "whatever"
    char[] chars = whatever.toCharArray();
    for(int i=0; i<chars.length; i++) {
    System.out.println( (int) chars[i] );
    And since its friday I wont flame you for not reading
    a simple tutorial, though its hard not to
    ehmm, the square brackets around the chars[i] are replaced by
    non-squares, or not visible, but they ARE square brackets

  • Convert ASCII File into HTML

    Hi All,
    I have a requirement to convert ASCII files (formatted files when opened through Textpad / Editplus) into HTML when its hyperlink is clicked from my application.
    The present code is that, the TXT file was streamed, html tags have been added and the entire file was re-written as HTML (based on char 12 / 32, as the case may be) and saved as JSP / HTML extension, and placed in a temp folder.
    response.sendRedirect() was used to open this file, which threw OutofMemoryException errors.
    It was also revealed that, if the original ASCII file was 40KB, the converted JSP file would be 160KB (around 4 times)
    The ideal conversion should be - add html tags in the new file and maintain the same formatting as the original ASCII file, & save the file with new extension.
    Thus I need a memory efficient method such that these files are converted on the fly by the application, yet the size kept minimum.
    Please suggest. Thanks in advance
    Regards
    Hari N

    160k is trival on a modern desktop OS. Especially since it is temporary. What heap size is the server using?

  • How to convert ASCII to CHAR?

    Hi, experts.
    Now I want to convert ASCII to CHAR, can you give me some methods? And I also want to know what's my ABAP Version.
    Thanks in advance!

    *After look so bad code that no work i did my own code, a gift for all you:*
    FORM CHARACTER_ASCII   using    p_letra
                                                 changing p_nro   type i.
    field-symbols: <n> type x.
    assign p_letra to <n> casting.
    move <n> to p_nro.
    ENDFORM.
    FORM ASCII_CHARACTER using    p_nro type i
                                               changing p_letra.
    DATA: c    TYPE c,
          x(4) TYPE x.
    FIELD-SYMBOLS: <fc>  TYPE c.
    x = p_nro.
    ASSIGN x to <fc> CASTING TYPE c.
    MOVE <fc>+1(1) to p_letra.
    ENDFORM.

  • How to convert ascii to character

    how to convert ascii to character is there any function module or any code.plz help me in finding this.

    Hi,
    please go through this
    If I give input as 65 (ascill value) I want display 'A'.
    Below logic is for convert from character to ascii value.
    report Ascii_convert.
    *Going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    *Going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    i hope this will help you ,
    Raja T

  • Hex code to ASCII

    Hey all,
    i'm programming a web application to take in an ASCII Art from a text field in a web page and store it in an sql database so that the application displays all
    the arts in another web page.
    however whenever someone types in: {
    it gets converted to %7b...
    thats not a big deal but when the other web page displays the collection of ascii arts it displays %7b instead of {.
    so all i wanna do is to convert the %7b to { before displaying it..
    kindly help..
    i wanna make a procedure which takes in something like: Hello%7bJava%7b!
    and converts it to: Hello{Java}!
    Ps. it should work for all hex codes and not only for %7b
    please not: i want to convert only hex code to ascii and not disturb any existing ascii..
    i.e in Hello%7bJava%7b!
    hello and java must be unaffected while %7b should be converted to {
    in other words i wanna convert only hex to ascii and not affect ascii
    Edited by: 992452 on Apr 1, 2013 11:33 PM

    however whenever someone types in: {
    it gets converted to %7b...It gets converted to that by what? Your Java code? Java JDK classes? SQL?

  • Converting ASCII to Binary

    Hello I need some help.
    I need to convert the ASCII data to Binary form. Like if i have the character 'A' and its ASCII is 65 then its binary would be 01000001.
    If there is any function/method available in java to convert ascii to binary, i would be really thanful.

    Hello I need some help.
    I need to convert the ASCII data to Binary form. Like
    if i have the character 'A' and its ASCII is 65 then
    its binary would be 01000001.
    If there is any function/method available in java to
    convert ascii to binary, i would be really thanful.
    byte ascii = 65;
    String binresult = "";
    for(int i=0;i<8;i++) {
      if(ascii%(2^i)=0) binresult += "0";
      else binresult += "1";
    }

  • SVG to JavaFX code Converter for Designer-Developer-Workflow

    I created an SVG to JavaFX code Converter while working on a project. Although its still a work in progress, it has been so useful for me ever since. Its available at convfx.codebase101.com for anyone that is interested in the Designer-Developer workflow (similar to JavaFX 1.x, which was the inspiration). [url http://www.codebase101.com/convfx/dist/convfx_dl.php]Download
    Hope someone finds it useful.
    Edited by: Burabari55 on Mar 22, 2012 6:41 PM, added download link.

    That is very nice Burabari, thanks for sharing it.

  • XSL function or code for ASCII conversion ?

    I am a newbie in XSL and I tried searching and didn't find a XSL function to convert ASCII values in an XML to its equivalent alphanumerals using XSL transformation.
    Is there a XSL function to do the same ?
    Any suggestions would be really helpful.

    There are such functions for converting Unicode codepoints to characters in XSLT2.
    Pete

  • Where's the best place to get code converted between ActionScript 2.0 and 3.0?

    Where's the best place to get code converted between ActionScript 2.0 and 3.0?
    If I just have occasional (very small) projects, what's the best way to get them done really fast by somebody who knows both 2.0 and 3.0?
    Thanks, Dan

    You have pretty much answered your own question... hire someone who has fairly thorough knowledge of both AS2 and AS3.
    I have heard there are some tools for converting between AS2 and AS3, but I have no knowledge of them other than having heard that they cannot convert all things.... which makes sense because there is not always a one-to-one relationship to how things ae done with AS2 and how they get done with AS3.

  • How to convert ASCII to an integer number??

    Here I am trying to send the number 1000000 from microcontroller through UART and I am recieving the ASCII in labview. But i would like to get exact 1000000 in labview too. So i am trying to convert ASCII to integer but i am unable to do that.
    Solved!
    Go to Solution.

    danil33 wrote:
    Hello mallik,
                       Please don't feel bad.Smercurio and all other experts are trying to make us to do things by our own.THis will make us experts in labview.Thats why he told you to go through the tutorials.I have heard such type of advice(sometimes they scold us) so many times.Still Iam hearingIt is our fault that we won't go through the tutorials properly.Don't get annoyed.
    Besides, the question is quite unclear formulated and makes me almost assume, that the OP hasn't even bothered to look for a solution himself. Since the OP receives a string it would be logical to look in the String palette for some function to do what he wants. And inside that palette there is magically a String/Number Conversion palette, which sounds almost like it could contain at least one function that could do the right thing. (In fact it contains 3 that could work, but I'm sure the OP can find the most logical one for his number easlily).
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • How can I open excel pdf files

    How can I open excel pdf files

  • Purchase order ship to party no at item level

    Hi All, I am able to get Ship To Party Address from ADRC table(Iam getting ADRNR from EKPO) But my client requirement is to get the KUNNR and not the address. Is there any way to get KUNNR based on ADRNR at item level .I have search through the (KNA1

  • Unable to change PO as a buyer

    Hi All, I have created purchase order for direct material, and stastus is on hold and when I looked as a buyer I can see the purchase order and when I try to change it, it says no authorizations to change could some  help me 1. How to give authrozati

  • Issue with DTW import of BP bank details

    Dear Experts, While trying to update IBAN & Swift Code for existing bank details in BP Master using DTW, below error appears :- Enter Valid Code (OCRB.BankCode) [?????173-36] Application defined or object defined error65171 I have checked the Bank co

  • Settlement rule while creating service order

    Hi Gurus, 1. can someone help me in knowing what should be passed as receivers key while updating settlement rule if i am using Sales Order for settlement ; sales order, sales order item, object number of item or something else because i tried to pas