Conversion of Packed Decimal Numbers to Java Data Types

Hi all,
I'm working with a mainframe file which contains datas in Packed Decimal Numbers.My requirement is to convert these datas to Java datatypes and also to convert the Java datatypes to Packed Decimal Numbers before storing them in the mainframe.
Can anyone help me out with any code for converting Java data types to/from other data formats such as: EBCDIC, IBM370 COMP (binary numbers up to 9 digits), and COMP-16 (packed decimal numbers)?
I would hugely appreciate any response to my query.
Thanking you all,
Kaushik.

Rather than go that route, I'd instead look into providing a "service" on your mainframe to:
1) provide a textual representation of the numbers (from native to text)
2) read text, converting to native numeric storage
And use that service to retrieve that information by your Java app (1)Similarly, instead of trying to write natively-formatted numbers from your Java app, I'd write it as text and make that same "service" read the text (2)
This is the kind of thing XML is for.

Similar Messages

  • External SOAP client Accessing Webservice using built in Java Data type

    We have built a webservice and deployed it on WLS. We accessed this from a swing
    client it works fine.The webservice methods uses non-built in JAVA data types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass to the
    webservice. We dont want to go by this way.Is there anyway were in we can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net client )
    will be able to exceute my webservice (i.e., passing the required Object which
    the method is expecting)?

    Hi Anish,
    Well first off, your web service doesn't send or receive "objects". It only sends
    and recieves XML, which is in turn converted to/from Java objects at invocation
    time. Second, a .NET (or Perl, or Python, or C++) client will be able to call
    your web service, because the wsdl.exe tool (for .NET) will generate "programming
    language specific" objects from the <types><schema> elements, in the WSDL of your
    web service :-) The wsdl.exe tool will create C# objects from the WSDL, that will
    convert XML to/from C# when your web service is called. That's the beauty of XML
    schema - it's a "universal typing system", so it's not tied to a particular programming
    language. The only issue is whether or not the web services platform vendor's
    XML Schema/WSDL processor, can successfully process the WSDL. Some vendors have
    more complete implementations of the WSDL and XML Schema specs than others, so
    expect varying success here. The one in WLS 7.0 is pretty good, so you shouldn't
    have too many problems consuming WSDL generated by .NET tools (or any other tool
    for that matter).
    Regards,
    Mike Wooten
    "Anish" <[email protected]> wrote:
    >
    We have built a webservice and deployed it on WLS. We accessed this from
    a swing
    client it works fine.The webservice methods uses non-built in JAVA data
    types
    as parameters.These are Value Objects and the JAVA Serializer and Deserializer
    classes are generated using Ant task itself.The client coding uses Value
    objects
    given by the Client_jar (generated using <Clientgen> ant task) to pass
    to the
    webservice. We dont want to go by this way.Is there anyway were in we
    can pass
    parameters to the method which expects non-built in java datatypes?
    Why i am asking this is, i want to know how an external client (.Net
    client )
    will be able to exceute my webservice (i.e., passing the required Object
    which
    the method is expecting)?

  • Java data types are tightly coupled or loosely coupled ?

    java data types are tightly coupled or loosely coupled ?

    Is this another interview question? If so, the answer you should have given is, "You, sir, have been smoking too much crack."

  • New user for java (Data type conversion)

    Hi all, I'm the newer from JAVA, just start to learn it few weeks before, there have some problem about me.
    I want to konw how to change the data type ??For example, if I have a string call year and store the char "1", how can I change that field to int type ?
    Thanks very much

    You should have a link to, or download, the API docs. You can see them on line at:
    http://java.sun.com/j2se/1.3/docs/api/index.html
    Look up the class Integer. It has a static method, parseInt() which takes a String argument and returns an int.. Since it is static, you can do the following:
    int value = Integer.parseInt(your_string);
    Then, to make it robust, you can put try/catch around it and catch NumberFormatException if you need to do error checking.

  • Java Data Types?

    Hi,
    shall we say
    The data types in Java 1.5 can be divided into 4 categories. They are:
    i.     Primitive Data Types
    ii.     Abstract Data Types
    iii.     Arrays
    iv.     Enumerated Data Types
    ...............?

    Raijinsetsu wrote:
    I have to agree with jverd...
    Abstract is not a data type. Abstract declares a specific type of class which cannot be instantiated. Enumerations are just specialized objects. Arrays are also specialized objects.One could choose to consider arrays, enums, and abstract classes as separate categories.
    >
    If you wanted, the full list would be:
    Object (reference is another term you could apply to objects)
    int
    long
    short
    byte
    charEven if you include the primitives you forgot, this list is just as arbitrary as the original one, and does not correspond to the JLS.
    In particular, Object is not a type. There are primitives, references, and the null type.
    Edited by: jverd on May 6, 2009 7:56 AM

  • Not converting anything but get error: "Conversion failed converting varchar value 'X' to data type int"

    I have created the following trigger that fires instead of an UPDATE statement and copies the altered data over to an Audit table before proceeding with the requested UPDATE. After doing so, I wrote a simple UPDATE statement for testing:
    UPDATE Products
    SET ProductCode = 'XYZ 2014', ProductName = 'Special Edition Tamborine', ListPrice = 74.99, DiscountPercent = .5
    WHERE ProductID = 28;
    When I run this, I get the following message:
    Msg 245, Level 16, State 1, Procedure Products_UPDATE, Line 14
    Conversion failed when converting the varchar value 'X' to data type int.
    Here is my trigger:
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE; -- LINE 14
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    INSTEAD OF UPDATE
    AS
    DECLARE @ProductID int, @CategoryID int, @ProductCode varchar, @ProductName varchar,
    @Description varchar, @ListPrice money, @DiscountPercent money, @DateUpdated datetime
    BEGIN
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM deleted;
    INSERT INTO ProductsAudit
    VALUES (@ProductCode, @CategoryID, @ProductCode, @ProductName, @ListPrice,
    @DiscountPercent, @DateUpdated);
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM inserted;
    UPDATE Products
    SET CategoryID = @CategoryID, ProductCode = @ProductCode,
    ProductName = @ProductName, Description = @Description,
    ListPrice = @ListPrice, DiscountPercent = @DiscountPercent
    WHERE ProductID = (SELECT ProductID FROM inserted)
    END
    I am confused a bit by (1) the location of the error and (2) the reason. I have looked over my defined data types and they all match.
    Could someone offer a second set of eyes on the above and perhaps guide me towards a solution?
    Thank you.

    This is an issue in this trigger. It will work for single record updates alone. Also for your requirement you dont need a INSTEAD OF TRIGGER at all.
    You just need this
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE;
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    AFTER UPDATE
    AS
    BEGIN
    INSERT INTO ProductsAudit
    SELECT ProductID,
    CategoryID,
    ProductCode,
    ProductName,
    ListPrice,
    DiscountPercent,
    GetDate()
    FROM deleted;
    END
    Now, in your original posted code there was a typo ie you repeated the column ProductCode twice
    I think one should be ProductID which is why you got error due to data mismatch (ProductID is int and ProductName is varchar)
    see below modified version of your original code
    IF OBJECT_ID('Products_UPDATE') IS NOT NULL
    DROP TRIGGER Products_UPDATE; -- LINE 14
    GO
    CREATE TRIGGER Products_UPDATE
    ON Products
    INSTEAD OF UPDATE
    AS
    DECLARE @ProductID int, @CategoryID int, @ProductCode varchar, @ProductName varchar,
    @Description varchar, @ListPrice money, @DiscountPercent money, @DateUpdated datetime
    BEGIN
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM deleted;
    INSERT INTO ProductsAudit
    VALUES (@ProductID, @CategoryID, @ProductCode, @ProductName, @ListPrice,
    @DiscountPercent, @DateUpdated);
    SELECT @ProductID = ProductID, @CategoryID = CategoryID, @ProductCode = ProductCode,
    @ProductName = ProductName, @Description = Description, @ListPrice = ListPrice,
    @DiscountPercent = DiscountPercent, @DateUpdated = GetDate()
    FROM inserted;
    UPDATE Products
    SET CategoryID = @CategoryID, ProductCode = @ProductCode,
    ProductName = @ProductName, Description = @Description,
    ListPrice = @ListPrice, DiscountPercent = @DiscountPercent
    WHERE ProductID = (SELECT ProductID FROM inserted)
    END
    I would prefer doing it as former way though
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Using java date type

    Hi,
    Is possible to use one data type defined in java in one forms.? How do yo define this type in forms. We need insert data in one vector java(defined in java).
    Thank all

    for example:
    javax.jcr.Session session = resourceResolver.adaptTo(Session.class);
    String parentPath = "/content/blah"; // or whatever your parent path is
    String nodetype = "nt:unstructured"; // or whatever other node type you require
    Calendar calendar = Calendar.getInstance(); // or whatever date
    Node node = session.getNode(parentPath).addNode("nodename", nodetype);
    node.setProperty("myproperty", calendar);
    session.save();

  • Java data type - byte

    Hi;
    I've a question here, hopefully some one can help me to clear my doubt.
    private byte[] buf = new byte[1024];
    as the declaration done above, does that mean the buf can hold until 1024 bytes data? as i know, byte data type only able to hold +2 power of 8 till -2 power of 7.
    YY.

    private byte[] buf = new byte[1024];
    as the declaration done above, does that mean the buf can hold until
    1024 bytes data? Yep, you've just defined an array of 1024 bytes, all neatly lined up next
    to eachother, the first byte can be retrieved or altered by indexing it like
    this: 'buf[0]', the next one as 'buf[1]' and the last one as 'buf[1023]'.
    as i know, byte data type only able to hold +2 power of 8 till -2 power of 7.Erm, almost; a byte can store any integral number in the range -128 to 127
    inclusive, i.e. -2**7 to 2**7-1.
    kind regards,
    Jos

  • WS returns an invalid java data type

    Hello guys, I started using BPM Studio 2 weeks ago, and I am stuck at this point:
    I get these message:
    Error workspace-1381754584564
    Activity '/TramitaciónPedido#Default-1.0/GlobalCreation[RealiarPedido]' task '' could not execute successfully.
    Detail:Method: '', Exception: 'El método 'CIL_beginBeginIn' de la clase 'OracleBPM_Lab2.TramitaciónPedido.Default_1_0.Instance' no se ha podido ejecutar correctamente.'
    Caused by: The method 'CIL_beginBeginIn' from class 'OracleBPM_Lab2.TramitaciónPedido.Default_1_0.Instance' could not be successfully executed.
    Caused by: Attempt to set empty javaType to return(hassetter hasgetter public,0) :: fuego.type.FuegoClass$LazyRef@190ce52. It must be null or a valid java type.
    fuego.papi.exception.ActivityFailedException: La tarea '' de la actividad '/TramitaciónPedido#Default-1.0/GlobalCreation[RealiarPedido]' no se ha podido ejecutar correctamente.
    Detalle:Método: '', Excepción: 'El método 'CIL_beginBeginIn' de la clase 'OracleBPM_Lab2.TramitaciónPedido.Default_1_0.Instance' no se ha podido ejecutar correctamente.'
    This is the code that calls the ws:
    // Inicilaiza parámetros fijos del expediente
    expediente.idInstancia = this.id.local
    expediente.intentosContactoCandidato = parametrosExpediente.maxIntentosContacto
    expediente.operador = null
    expediente.documentalista = null
    expediente.tarificador = null
    expediente.unidadOrganizativa = UnidadesOrganizativas.spain
    logMessage "Guzman: expediente.idInstancia "+expediente.idInstancia
    logMessage "Guzman: expediente.intentosContactoCandidato: " +expediente.intentosContactoCandidato
    logMessage "Guzman: expediente.unidadOrganizativa: "+expediente.unidadOrganizativa
    respuestaCRM as SCOR.WEBSERVICES.CRM.FrontalWsdl.RespuestaCRM
    filtro as SCOR.WEBSERVICES.CRM.FrontalWsdl.Filtro
    filtro.clave = ClaveFiltro.EXPEDIENTE
    filtro.valor = "00020353"
    usuarioCRM as SCOR.WEBSERVICES.CRM.FrontalWsdl.Usuario = SCOR.WEBSERVICES.CRM.Usuario()
    logMessage "Guzman: filtro.clave= "+filtro.clave
    logMessage "Guzman: filtro.valor= "+filtro.valor
        usuarioCRM.unidadOrganizativa = "ES"
        usuarioCRM.usuario = "usuarioBPM"
        usuarioCRM.clave = "P@ssword"
        usuarioCRM.dominio = "adminesp"
    consultaExpediente FrontalService
        using arg0 = usuarioCRM,
              arg1 = filtro
        returning respuestaCRM = @return
    logMessage "Guzman: usuarioCRM.unidadOrganizativa: "+usuarioCRM.unidadOrganizativa
    logMessage "Guzman: usuarioCRM.usuario: " +usuarioCRM.usuario
    logMessage "Guzman: usuarioCRM.calve: "+usuarioCRM.clave
    logMessage "Guzman: usuarioCRM.dominio: "+usuarioCRM.dominio
    I know wich is the problem but I don´t know how to solve it, I will apreciate any help, thanks in advance.

    SQL Developer may not recognise the date formats in your EXCEL so you need to tell it what it is. Check and note the value of the date column in the EXCEL file, then use the date format in the Map Source Data to Existing Table section in SQL Developer during the Import Data dialog.
    For example. if the data in EXCEL is 22-JUN-09. Select the column in the above mentioned section and enter DD-MON-RR (or DD-MON-YY) in the Date Format before klicking Next to Verify. This should work perfectly.

  • Conversion of a binary data stream to decimal numbers

    Hi
    I am having great difficult working out how to convert my binary data stream to decimal numbers.
    The data I am reading back is in the format of a binary string, starting with the Most Significant Bit (MSB) of the first word, then the corresponding Least Significant Bit (LSB), where a word is two bytes long. A carriage return indicates message termination.  The return message starts with ‘bin,’ followed by the number of bytes requested. No delimiters are used to separate the data, but a carriage return is appended onto the end of the data.
    bin,<first word msb><first word lsb>...<last word lsb><CR>
    e.g. bin,$ro¬z1;@*...etc
    Does anybody know of any examaple vi that can help me convert this data from binary to decimal numbers?
    Many Thanks
    Ash

    Hi Ashley,
    after getting the string you can strip the first 4 characters. After this try a typecasting to array of U16. If the numbers are not correct, you can add a swap bytes operation to the resulting array.
    Message Edited by GerdW on 09-13-2006 02:46 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    Convert.png ‏2 KB

  • Problem with importing decimal numbers in Apex

    Hi,
    I have a ascii data file which I load into db tables calling a procedure in a db package.
    Executing the procedure by SQL Plus everything works fine.
    Calling the procedure by Apex button I get a "ORA-01722: invalid number; Error inserting subject" because of the decimal numbers in the data file. Taking the decimal numbers out of the file it works.
    - I tried with different formats in the data file like: 4.40 4,40 4.4 4,4: Makes no difference.
    - In Apex I tried column formatting in the report attribute: 999G999G999G999G990D00: Makes no difference, it's obviously only formatting the display.
    - Debug mode just shows there is an error..
    - The db column is of format NUMBER(10,2)
    As I mentioned, with SQL Plus it works no matter of the number format in the data file.
    Anybody has an idea where the problem might be?
    Help is greatly appreciated,
    Roger

    Hi Joel,
    Thanks for your reply. You were right, the NLS setting for the decimal separator in SQL*Plus is a , (komma) and in Application Express a . (point).
    I suspected a NLS problem that's why I tested with different formats in the data file (4.40 4,40). Shouldn't that make a difference?
    Now, to fix it: I didn't see in Apex any NLS settings, I checked in utilities and shared components. So, the way to do that is to directly write into SQL Workshop / Apex?
    ALTER SESSION SET NLS_NUMERIC_CHARACTERS=",' "
    Cheers,
    Roger

  • Java rounding for Double data type

    Hi,
    Is there a way to change the default precision to 2 digits after decimal point for Double data type.

    java.text.DecimalFormat:
    import java.text.DecimalFormat;
    DecimalFormat format = new DecimalFormat("#.00");
    StringBuffer formatted = format.format(Math.PI, new StringBuffer(), new FieldPosition(0));
    System.out.println(formatted); // prints out 3.14Probably as applicable today as it was 3 years ago

  • How do I return a java.sql.Timestamp data type in a Web service?

    I'm new to workshop and java. I'm creating a mini application to simulate a real work Web Service (development environment is on an intranet). I was able to completely simulate the Web Services minus all date values.
    I'm using a standard weblogic workshop database controls that are feeding the various WebServices and their methods (Web services was generated from DB control). I get a java type not support error when I attempt to return a java.sql.Timestamp. I temporarily got around the problem by omitting all dates from the sql.
    However, we are at the point where we need the complete record.
    My two questions
    1) What java data type do I convert the java.sql.Timestamp to
    2) Where and how do I do it in workshop.
    Thanks in advance
    Derrick
    Source view from workshop looks something like this.
    public interface MyData extends DatabaseControl, com.bea.control.ControlExtension
    static public class dbOverallRec
    public String key;
    public String field1;
    public int field2;
    public java.sql.Timestamp create_date
    public dbOverallRec () {};
    *@jc:sq; rowset-name="OverallRowSet" statement::
    *select key, field1, field2 ,create_date from overall where key={KEY}::
    dbOverallRec getOverallByKey(String Key);
    * I had to omit the create_date to get it to work

    You should try changing java.sql.Timestamp to java.util.Calendar.
    java.util.Calendar maps to the dateTime type in XML Schema, and TIMESTAMP as a JDBC type.
    Regards,
    Mike Wooten

  • How to insert data type information to oracle database

    Hi, there,
    I want to insert date information to oracle database in a jsp page using JSTL. but always got wrong message:
    javax.servlet.jsp.JspException:
    INSERT INTO DATE_TEST
    (date_default,date_short,date_medium)
    values(?,?,?)
    : Invalid column type
    I don't know how to convert java date type to oracle date type or vice versa. the following is the source code(all the fields of DATE_DEFAULT,DATE_SHORT,DATE_MEDIUM are oracle date type. and even I want to insert d instead d1, I got the same wrong message)
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page import="java.util.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <%
    Calendar now;
    Calendar rightNow = Calendar.getInstance();
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <h2>
    The current time is:
    </h2>
    <p>
    <%= new java.util.Date() %></p>
    <%
    java.util.Date d=new java.util.Date();
    java.sql.Date d1=new java.sql.Date(d.getYear(),d.getMonth(),d.getDate());
    out.print(d1.toString());
    %>
    <sql:update>
    INSERT INTO DATE_TEST
    (DATE_DEFAULT,DATE_SHORT,DATE_MEDIUM)
    VALUES(?,?,?)
    <sql:dateParam value="${d}" type="date" />
    <sql:dateParam value="${d}" type="date" />
    <sql:dateParam value="${d}" type="date" />
    </sql:update>
    </body>
    </html>
    thank you very much for the great help!!

    I don't have time to read thru all your code, but I hope this information will help you.
    It depends on how the Oracle database was set up. Usually, the date format is something like this: '27-MAY-2003 22:10:00'. A quick check will be to run this SQL script in SQLPlus:
    select sysdate from dual;
    You have to convert the date from textbox or whatever to this exact Oracle format. Otherwise, Oracle will not accept it. It is very picky on that. I found the best way is to do the conversion inside the SQL statement. It makes life so much easier.
    Hope this helps.

  • Data Type for File adapter

    hi all,
    we have a scenario which is idoc-xi-file
    the output data type should be something like this:
    [Data.1]
    Promo,1000,,,,,,,
    PromoD,2000,,yup
    Item,1,IGRP,,,,,,FTY,3
    Tier,1,,,,,,,ITEM,,
    Itemy,1,IGRP,,,,,,FTY,1,A_,100,,ELST
    we have to use file content conversion parameters for this as well as this needs to be converted to a CSV file format(third party system).
    any help in declaring this kind of data type(structure) and handling file content conversion parameters would be highly appreciated.
    for data type if any anybody can help me build the structure or give an example!!!
    would be gr8!!!
    thanks in advance
    ahmed

    Hi Parvez,
    For file content conversion, you can refer the below link:-
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
    I hope this helps.
    Regards.
    Praveen

Maybe you are looking for

  • EJB 3.0 Web service fail to deploy when ws result is on a diff lib project

    I'm trying to develop a web service using EJB 3.0 with annotations. I'm using Netbeans 5.5 EE. The web service should returns an object declared on another Netbeans project. ( a library.jar). Netbeans compiles everything alright, although when I depl

  • Mouse scrool wheel events

    Hello! I noted that in CVI 9.0 when  using a slide control (hot mode) with the mouse scroll wheel, the only event generated is EVENT_MOUSE_WHEEL_SCROLL. But in CVI 2013 the same control generates EVENT_MOUSE_WHEEL_SCROLL, EVENT_VAL_CHANGED and EVENT_

  • Db50 transaction then it says "Runtime error '6': Overflow"

    hi all, while start to perform full backup from dbmgui if launch from db50 transaction Tools tree then it says "Runtime error '6': Overflow " kind of pop-up message comes. I want to attach screenshot here. How can I do that? Is it possible? Thanks in

  • What is the reason for so many Drop Zones in iDVD?

    Thank you Tboake and Terry for helping with my project. Now I am convinced that to create my show which mixes pictures, Text, movie clips and music, as well all the other effects, iDVD is the right way to start. However I have a question regarding th

  • Where is the printer queue stored - and how to delete all queue jobs?

    I ran into a problem after I installed the Roll paper feeder on my Epson R1800. All of a sudden files will not print anymore. One thing that may cause a problem is that there are two previous files (pdf I think) that someone else tried to print yeste