ANSI Conversion

Visual FoxPro has a function called ASC which takes a given
string and returns the ANSI character code corresponding to the
first letter in a string. I'm converting the FoxPro to Java and
Oracle and need a Java equivalent for the ASC function. Can
anyone help?

Pardon me, Glenn,
I may have misunderstood your question. If you want to do the
conversion directly in java (not using Oracle -- that's what may
have confused me, but your question still belongs in the JVM
forum -- not the J2EE forum), then a simple perusal of the
javadoc (available online from http://java.sun.com/docs) for
class 'java.lang.String' reveals the following method:
public char charAt(int index)
Returns the character at the specified index. An index
ranges from 0 to length() - 1.
Then you could use this method from class 'java.lang.Character':
public static int getNumericValue(char ch)
Returns the Unicode numeric value of the character as a
nonnegative integer.
Note that java uses Unicode -- so the above may not give you what
you expect.
Good Luck,
Avi.

Similar Messages

  • EBCDIC to ANSI Conversion

    Hi,
    We have a question from the partner and they want to know how the data from mainframe can be converted from EBCDIC to ANSI format?
    Any pointer would be helpful.
    Thanks
    Umesh

    Check out the DB2 z/OS Installation & Setup guide (...and, I think you mean ASCII and not ANSI...)
    If you use a typical GG capture process + data pump to send data to/from z/OS to/from unix/linux/windows, then GoldenGate v10+ should automatically convert between ASCII and EBCDIC when the pump sends the data to the remote trail. (It's been a while since I've tried.... But you can use logdump to verify if you have the environment to test with.) See the limitations in the aforementioned guide (e.g., multi-byte characters are not converted, unicode is not converted).
    Also, you may have to explicitly add in a conversion parameter if going to/from Nonstop... if you are, see the GG win/unix upgrade instructions for GG v11. It's just one parameter that I'm omitting here so as not to confuse the issue.
    Note also that if you're using logdump, there are specific ebcdic commands you can use to view trail data & trail header info on z/OS. Just type "help" in logdump on z/OS for all the options.
    If you're attempting to convert any of the unsupported data types -- then you'll probably have to do it in the database post-replication (e.g., Oracle DB has functions to do this), such as loading a staging table with the ebcdic data that is in turn processed and loads your ascii table. (There are probably a number of ways to accomplish this with varying degrees of complexity.)
    Cheers,
    -m

  • Ansi2unicode

    Good day ppl, I require your assistance.
    I am reading an rtf document, parsing it and puting text into database for further use. However that data is in ansicpg 1251 (Windows 3.1 (Cyrillic)). This poses some problems as I need to be able to either store the data in unicode or transform user's query to ascii so that I can search the database. I am however cueless how that can be done. Enlighten me someone
    (exerps from rtf referense:)
    Word 2002 is a Unicode-enabled application. Text is handled using the 16-bit Unicode character encoding scheme. Expressing this text in RTF requires a new mechanism, because until this release (version 1.6), RTF has only handled 7-bit characters directly and 8-bit characters encoded as hexadecimal. The Unicode mechanism described here can be applied to any RTF destination or body text.
    \ansicpgN This keyword represents the ANSI code page used to perform the Unicode to ANSI conversion when writing RTF text. N represents the code page in decimal. This is typically set to the default ANSI code page of the run-time environment (for example, \ansicpg1252 for U.S. Windows). The reader can use the same ANSI code page to convert ANSI text back to Unicode. Possible values include the following:

    1. Your problem statement is vague. "however that data is in ansicpg... "
    What data is in ansi?

  • CONVERSION FROM ANSI ENCODED FILE TO UTF-8 ENCODED FILE

    Hi All,
    I have some issues in conversion of ANSI encoded file to utf encoded file. let me tell you in detail
    I have installed the Language Support for Thai Language on My Operating System.
    now, when I open my notepad and add thai character on the file and save it as ansi encoding. it saves it perfectly and also I able to see it on opening the file again.
    This file need to be read by my application , store in database and should display thai character on jsp after fetching the data from database. Currently it is showing junk character on jsp reason being that my database (UTF8 compliant database) has junk data . it has junk data because my application is not able to read it correctly from the file.
    If I save the file with encoding as UTF 8 it works fine. but my business requirement is such that the file is system generated and by default it is encoded in ANSI format. so I need to do the conversion of encoding from ANSI to UTF8 . so Any of you can guide me on the same how to do this conversion ?
    Regards
    Gaurav Nigam

    Guessing the encoding of a text file by examining its contents is tricky at best, and should only be done as a last resort. If the file is auto-generated, I would first try reading it using the system default encoding. That's what you're doing whenever you read a file with a FileReader. If that doesn't work, try using an InputStreamReader and specifying a Thai encoding like TIS-620 or cp838 (I don't really know anything about Thai encodings; I just picked those out of a quick Google search). Once you've read the file correctly, you can write the text to a new file using an OutputStreamWriter and specifying UTF-8 as the encoding. It shouldn't really be necessary to transcode files like this, but without knowing a lot more about your situation, that's all I can suggest.
    As for native2ascii, it isn't for encoding conversions. All it does is replace each non-ASCII character with its six-character Unicode escape, so "voilá" becomes "voil\u00e1". In other words, it avoids the problem of character encodings by converting the file's contents to a form that can be stored as ASCII. It's mainly used for converting property or resource files to a form that can be read by the Properties and ResourceBundle classes.

  • ANSI X12 meta data availability in conversion agent??

    Hello,
    Is there a provision for availability of ANSI X12 meta data in SAP conversion agent. We are trying to process EDI orders using the X12 INDUSTRY standard. Please advise.
    -Kris

    hi,
    SAP Conversion Agent together with SAP Net Weaver, enables  to automate complex integration activities for a multitude of data and document formats. These include unstructured and partially structured documents such as Office files, data streams, printing applications, and other application-specific formats.
    Easily integrate unstructured and semi-structured data into SAP Net  Weaver Process Integration using the Conversion Agent.
    Conversion Agent dynamically converts unstructured messages from   Microsoft Word,Excel,PDF plain text. 
    Semi-structured formats such as HL7,SWIFT,HIPA, ANSI X12 and COBOL to   PI understandable SOAP XML.
              So that it helps to easily integrate the information need into the back-end systems. Conversion can also be used as the reverse process to convert from XML to unstructured or semi-structured formats
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/sap%2bconversion%2bagent%2b-%2bthe%2blong%2bjourney
    Conversion Agent - Handling EDI termination characters
    Conversion Agent a Free Lunch?
    Integrate SAP Conversion Agent by Itemfield with SAP XI
    regards
    sr

  • Conversion of XML file from ANSI to UTF-8 encoding in SAP 4.6C

    Hi All,
      Im working on SAP 4.6C version.I have generated a XML file from my custom report.It is downloading in ANSI format.But i need to download this into UTF-8 format.So can anyone please let me know how to do this?
    Is this possible in 4.6C version?
    Thanks in Advance,
    Aruna A N

    Hello
    It is possible in 4.6.
    Try this code:
    REPORT Z_TEST_XML_DOWN .
    data:
      lp_ixml type ref to if_ixml,
      lp_xdoc type ref to if_ixml_document,
      lp_sfac type ref to if_ixml_stream_factory,
      lp_ostr type ref to if_ixml_ostream,
      lp_rend type ref to if_ixml_renderer,
      lp_enco type ref to if_ixml_encoding.
    data:
      lp_root type ref to if_ixml_element,
      lp_coll type ref to if_ixml_element,
      lp_elem type ref to if_ixml_element.
    class cl_ixml definition load.
    data:
    udat like lfa1,
    s type string.
    select single * from lfa1 into udat where lifnr = '0000000001'. " <- set here real number
    *** create xml
    lp_ixml = cl_ixml=>create( ).
    lp_xdoc = lp_ixml->create_document( ).
    lp_root = lp_xdoc->create_simple_element( name = 'Node'
                                              parent = lp_xdoc ).
    s = udat-land1.
    call method lp_root->set_attribute( name = 'country_name'
                                        value = s ).
    s = udat-name1.
    call method lp_root->set_attribute( name = 'vendor_name'
                                        value = s ).
    s = udat-ort01.
    call method lp_root->set_attribute( name = 'city_name'
                                        value = s ).
    *** render xml
    types: begin of xml_tab_line,
             line(256) type x,
           end of xml_tab_line.
    types: xtab type table of xml_tab_line.
    data: t_xml type xtab,
          size type i,
          rc type i.
    lp_sfac = lp_ixml->create_stream_factory( ).
    lp_ostr = lp_sfac->create_ostream_itable( table = t_xml ).
    lp_enco = lp_ixml->create_encoding( character_set = 'utf-8'
                                   byte_order = if_ixml_encoding=>co_none ).
    call method lp_ostr->set_encoding( encoding = lp_enco ).
    lp_rend = lp_ixml->create_renderer( ostream = lp_ostr
                                        document = lp_xdoc ).
    rc = lp_rend->render( ).
    *** export to file
    size = lp_ostr->get_num_written_raw( ).
    call function 'WS_DOWNLOAD'
      exporting
        bin_filesize = size
        filename = 'c:\sapxml_test.xml'
        filetype = 'BIN'
      tables
        data_tab = t_xml
      exceptions
        others = 1.
    It is just simple example.

  • Need help on ANSI sql conversion

    Existing Query:
    select (list of columns from list of tables) from EMPANS A,EMPANS_MEMO M,QSTLINK L,QSTN Q
    WHERE A.FLDCOMMENT =M.FLDREC_NUM(+) AND L.FLDFORM = ? AND L.FLDQUESTION = A.FLDQUESTION AND L.FLDROLLOVER = 'y' AND Q.FLDCODE = L.FLDQUESTION AND
    (Q.FLDINACTIVE IS NULL OR Q.FLDINACTIVE <> 'y')
    Ansi Converted:
    select (list of columns from list of tables) from EMPANS A LEFT OUTER JOIN EMPANS_MEMO M ON (A.FLDCOMMENT =M.FLDREC_NUM)
    INNER JOIN QSTLINK L ON ( A.FLDQUESTION =L.FLDQUESTION )
    INNER JOIN QSTN Q ON (L.FLDQUESTION = Q.FLDCODE )
    WHERE L.FLDFORM = ? AND L.FLDROLLOVER = 'y' AND
    (Q.FLDINACTIVE IS NULL OR Q.FLDINACTIVE <> 'y')
    could any body let me know , is this correct.
    thanks for your support.

    Hello, this is the ANSI equivalent:
    SELECT...
    FROM EMPANS A
      JOIN QSTLINK L ON ( L.FLDQUESTION = A.FLDQUESTION)
      JOIN QSTN Q ON (Q.FLDCODE = L.FLDQUESTION)
      LEFT JOIN EMPANS_MEMO M ON (A.FLDCOMMENT =M.FLDREC_NUM)
    WHERE L.FLDFORM = ?
        AND L.FLDROLLOVER = 'y'
        AND (Q.FLDINACTIVE IS NULL OR Q.FLDINACTIVE 'y')

  • ANSI SQL to Oracle Old SQL conversion

    I need help to convert this ANSI SQL Query to Oracle Old school (With inline views and =(+) joins and where clasuses)
    CUrrent Query and new one should return same resultset
    ---------------------------------Query Start----------------------------------------------------
    SELECT COUNT(*)
    FROM
    SELECT
    'XXXXXX' as Big_Boss,
    da.Direct,
    da.Director,
    da.Manager,
    da.SubArea,
    da.Project,
    da.Project_Name,
    da.Project_Class,
    da.HISL,
    da.Resource_Name,
    da.Resource_Status,
    da.mon,
    to_char(sysdate, 'dd-Mon-YYYY') AS "Current_Date",
    DECODE(da.Project, NULL, 0, round(da.Slice / da.month_total, 2)) as
    "Approved_Demand",
    SUM(da.Availability) as "Headcount"
    FROM
    SELECT
    w.level4_name AS Direct,
    w.level5_name AS Director,
    w.level6_name AS Manager,
    w.level7_name AS SubArea,
    INV.Code as Project,
    inv.name as Project_Name,
    det.hum_project_gate as Project_Class,
    r.id AS HISL,
    r.full_name as Resource_Name,
    lookup.lookup_code as Resource_Status,
    alc.slice AS Slice,
    alc.slice_date as Mon,
    avl.slice AS month_total,
    alc.slice / avl.slice as FTE,
    count(distinct r.id) AS Availability
    FROM
    nbi_dim_obs w,
    prj_blb_slices_m_avl avl,
    prj_obs_units obs,
    cmn_lookups lookup,
    srm_resources r
    **************   Section to be Converted   ***************************----------
    ----------------------------Start----------------------------------------------------
    left outer join(prj_resources t inner join srm_resources res on
    t.prprimaryroleid = res.id) on r.id = t.prid
    left outer join(prj_blb_slices_m_alc alc
    left outer join(prteam tm
    inner join(inv_investments INV inner join odf_ca_project det on det.id = inv.id
    and det.hum_project_gate = 'approved_for_development') on tm.prprojectid = INV.ID
    and INV.Is_Active = 1) on alc.prj_object_id = tm.prid
    and alc.investment_id = inv.id) on alc.resource_id = t.prid
    --------------------------------------End--------------------------------------------
    -- inner join prj_blb_slices_m_avl avl on alc.resource_id = avl.prj_object_id
    -- inner join prj_obs_units obs on res.unique_name = obs.unique_name
    -- inner join nbi_dim_obs w on w.level7_unit_id = obs.id
    WHERE
    w.obs_type_name = 'Workgroup'
    AND alc.slice > 0
    AND alc.slice_date = avl.slice_date
    AND r.is_active = 1
    AND r.person_type = lookup.id
    AND w.level7_unit_id = obs.id
    AND alc.resource_id = avl.prj_object_id
    AND res.unique_name = obs.unique_name
    GROUP BY
    w.level4_name
    , w.level5_name
    , w.level6_name
    , w.level7_name
    , r.id
    , r.full_name
    , lookup.lookup_code
    , inv.code
    , inv.NAME
    , det.hum_project_gate
    , alc.slice_date
    , alc.slice
    , avl.slice
    ) DA
    GROUP BY
    da.direct
    , da.director
    , da.manager
    , da.subarea
    , da.project_class
    , da.hisl
    , da.resource_name
    , da.resource_status
    , da.project
    , da.Project_Name
    , da.mon
    , da.availability
    , da.slice
    , da.month_total
    ORDER BY
    da.direct
    , da.director
    , da.manager
    , da.subarea
    -------------------------------Query End----------------------------------------------------------

    Joins are joins ... what do you mean by "nested" joins?
    If you are concerned about outer joins that can be performed using ANSI syntax that are not supported in the classic Oracle syntax then use in-line view and outer join the views.
    If your code was properly formatted it would be possible for someone to read it and possibly see what you are seeing.
    Read the FAQ page and learn to format your posted code.

  • ANSI / ASCII conversion

    Please post in any views about converting ANSI file to ASCII file.
    Deepa Datar

    Actually, I have developed an application, where the client writes to a file from Telnet client in windows. When the user types the characters its stored in the file. When the client types in backspaces or delete keys etc. the ansi format of the keys (backspaces and del etc.) are aswell stored.
    so I want to convert the file to ascii.
    OR
    I want to buffer the stream of the file data to be stored in the file, and modify the stream data based on the keys entered by the client.
    Deepa Datar

  • I want to get the file in ANSI format.. Any idea?

    Hi all,
    I am doing a file to file bypass scenario .My client has demanded that the output file should be in ANSI format.
    I checked the <b>file.encoding</b> option in sap-help but ANSI is not available can u suggest that what encoding type i must use.
    I used ISO-8859-1 as well.But client rejected this file saying that ANSI characters not present in ISO-8859-1
    Any one pls throw some light on this how to acheive.
    Regards
    Seema.

    Hi Stefan,
    Thanks for those links.. I have few doubts .. please suggest me.
    Based on those links and as per my thinking, now i have to follow below steps in File Module .
    Processing sequence:
    <b>Module Name :</b> AF_Modules/StrictXml2PlainBean
    <b>Type :</b> Local Enterprise Bean
    <b>ModuleKey :</b> 0
    <b>Module Name :</b> AF_Modules/StrictXml2PlainBean
    <b>Type :</b> Local Enterprise Bean
    <b>ModuleKey :</b> 1
    Module Configuration :
    <b>ModuleKey :</b> 0
    <b>Parameter Name :</b> singleRecordType (Since it is Bypass scenario,i want the entire file to have endseparator as /r/n.)
    <b>Parameter value: </b> What i need to mention i this field??
    <b>ModuleKey :</b> 1
    <b>Parameter Name :</b> Convert
    <b>Parameter value:</b>  No value ??
    In the links, i found these 3 parameters stating as
    Enter the parameter convert. It can have the following values:
    &#9679;     none - no conversion
    &#9679;     CRLFtoLF - conversion from Microsoft Windows CRLF to Unix LF
    &#9679;     No value or another value - conversion from Unix LF to Microsoft Windows CRLF
    So now i want the file to be in (CRLF).SO i need to mention "No value" here??
    Please suggest me stefan if iam thinking in correct way.
    Regards
    Seema.

  • DATE vs DATETIME conversion

    I am running into a strange issue which is preventing me to finish my project. Any help would be greatly appreciated. 
    It looks like the CONVERT (the same goes for CAST) function treats DATE and DATETIME conversions differently when executed by a user with the Dutch language settings.
    Here is what I mean, I run the following query:
    SELECT CONVERT(DATE, '2014-09-01 23:00:00'), CONVERT(DATETIME, '2014-09-01 23:00:00')
    The results are:
    2014-09-01, 2014-01-09 23:00:00
    The conversion to DATETIME swapped the month and the day around, while this doesn't happen for the DATE conversion. The DATE conversion is the correct format, since I supplied it YYYY-MM-DD HH:mm:ss.
    When I run the same query using a user with the default language settings (en-US I assume) the same query works fine (no swapping of month and day values). 
    Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? 
     

    >> Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? <<
    CONVERT() is an old Sybase string function. It was created to keep 960's COBOL programmers happy since SQL does not have a PICTURE clause to put data in display formats. 
    CAST() is the ANSI/ISO Standard function to convert data types and this is what you should be using. It is not a string function. It uses the ISO-8601 standard for dates (yyyy-mm-dd), as you have seen. This is the only -– repeat, only! -- format allowed in
    SQL. Microsoft is a few decades behind and trying to catch up now.
    A good SQL programmer will do any local display formatting in the presentation, which will handle local languages that are never used in the database. Want to have some fun? The names of months in Polish, Czech, Croatian, Ukrainian and Belarusian not based
    on the Latin names used in most European languages. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Convert ANSI to UTF-8

    hi guys,
        recently i import xml file to other system, but the source xml's format is ANSI and maybe contain english,simplified Chinese,Chinese Traditional and so on. so i need to develop a custome receive pipeline for this. and i did it as below
    reference,it still can not convert it correctly.
    http://blogs.msdn.com/b/apacbiztalk/archive/2013/02/01/how-to-convert-messages-from-ansi-to-utf8-encoding-in-a-pipeline-component.aspx
    who can tell me the reason?

    Hi,
    I doubt its just encoding conversion as you are dealing with NON-ANSI characters (Chinese,Chinese Traditional and so on). I would suggest first you can format the xml than you can go ahead with encoding conversion .
    Thanks
    Abhishek

  • Problem writing file ANSI to UTF-8. OPEN DATASET FOR OUTPUT IN TEXT MODE

    Hello everybody,
    My report needs  to create a file in ANSI so I am using this sentence: * "OPEN DATASET p_dir_a FOR OUTPUT IN TEXT MODE ENCODING DEFAULT."*  almost all charters in the file are well generating excepting for this two: ( Á ) & ( Í ) because SAP assigns the same code to both characters ( Ã? ) = 'xC3'  which is not correct, the right code should be ( Á ) = 'xC1'  ( Í ) = 'xCD' respectively
    from this string = ( ÁÉÍÓÚáéíóúàèìòùÀÈÌÒÙ ) only those two characters are wrong converted.
    Also I tray to catch a conversion error with this sentence:
              TRY.
                TRANSFER <field> TO p_dir_a NO END OF LINE.
              CATCH cx_sy_conversion_codepage.
                MESSAGE 'error' type 'I'.
            ENDTRY.
    but never enters in it.
    Does anyone know where I can configure SAP to SET this value correctly?
    Thanks for your help.

    was a server problem, not SAP

  • Convert data from ANSI to UTF-8 format

    Hello,
    We have data in ANSI format (binary) which we need to convert into UTF-8 format. We are able to do it using FM's GUI_UPLOAD and GUI_DOWNLOAD but as the amount of data is huge we are planning to get the conversion done using background job. But, we are not able to get it yet. Can anybody suggest ways to resolve this? Can class CL_ABAP_CONV_X2X_CE be used for the same?
    Thanks...
    With Regards,
    Mukul Kulkarni

    Hello,
    If you have the data in Binary mode, you can use the addition IN BINARY MODE while uploading.
    For downloading in UTF-8, you can use the addition TEXT MODE ENCODING UTF-8.
    BR,
    Suhas

  • Error: At the conversion of a text from codepage '4110' to codepage '4102':

    I am trying to open an ANSI file from Application server.
    I am using "open dataset F_FILENAME for input in text mode encoding default."
    For some ANSI files it works fine, and for some it fails. I want to open this file and validate it , post it back on to application server
    with its original format.
    How do I achieve this? THanks,
    Below is the system config.
    Database codepage                         Unicode
    Current Codepage of Appl. Server    4102
    Codepage of Front End               4110  UTF-8 GUI

    Hi Shabbir,
    The statement "open dataset F_FILENAME for input in text mode encoding default" would open the file with the default codepage of your system which is 4102 for your system.
    Due to which the SAP system implicitly coverts the characters in the file to 4102 codepage. You might get "CONVT_CODEPAGE" error if system is not able to convert some characters in the file.
    You should use
    Open dataset F_FILENAME for input in legacy text mode code page 1100
    Check the following link for syntax.
    [open dataset in SAP|http://help.sap.com/saphelp_nw04/helpdata/en/79/c554a0b3dc11d5993800508b6b8b11/frameset.htm]
    You can also use " IGNORING CONVERSION ERRORS " to avoid "CONVT_CODEPAGE" errors..
    Cheers
    Ajay

Maybe you are looking for

  • Unrepairable Disc after 10.4.8 update

    After using software update to install the current combined 10.4.8, I am now unable to start my mac due to a kernal panic that happens at startup. I used disc utilitis to check and repair my disc, I find that the illigeal name, unable to repair 1 vol

  • When turned on, the dial keeps loading

    serious help >_< when i turn on my iMac it goes to the loading screen, but the dial keeps on turning and loading i cannot get to my desktop! the last thing i did before this happened was i had updates for my intel processor and photo booth i restarte

  • Procurement for one company and keeping stock in other company .

    We have one requirement . Company A will procure material from an Vendor and the delivery address and the stock will be stored by another company .How it can be done in SAP. The , PO & Invoice will be by A and GR by B .. Any suggestion please

  • After upgrade to SP4, cann't run my app.

    hello, My application works very well in SP3, after upgrade to SP4, everything seems work fine. But there is one problem by using the <netuix:/> I add this in the <netuix:header/> <netuix:header> <html:table style="vertical-align: top; width: 100%;">

  • Using Time Machine for two computers, not simultaneously.

    Using a WD external HD via Firewire 800 to backup my main computer with Time Machine. I use my 13" MacBook Pro while away from home for weeks, then putting it away when home. (Note: not networking between them.) I do want each computer to be identica