|
Ron, Not sue what you mean, but as an example. Date[0] = 2005-03-01 and closingprice = 4.77686. When converted to BigDecimal converts to 050103 & 4.77 respectively and this is converted to AS400ZonedDecimal. The sqlstmt = "Insert into BLMINTF1 (RTDTE, RTRATE) values (xxxx, xxxx)" where xxxx looks like some gibberish in Qshell. rgds, Rajesh Anand Email:Rajesh_anand@xxxxxx -----Original Message----- From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of RPower@xxxxxxxxxx Sent: 27 June 2005 17:24 To: Java Programming on and around the iSeries / AS400 Subject: Re: Error when converting Java Types to AS400 data Types Would you mind posting the value that prints out for sqlstmt? Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ________________________________________________________________________ ___ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill "Anand, Rajesh" <Rajesh_Anand@xxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 27/06/2005 01:25 PM Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To <java400-l@xxxxxxxxxxxx> cc Subject Error when converting Java Types to AS400 data Types Folks, Another bit of help needed from experts in this forum. Here is the snippet of my code where I'm converting Java String types to Zoned Decimal As400 Types. Both Date[] and closingprice [] are of types String. The file BLMINTF1 has both these fields defined as Zoned. String d1 = date[i].substring(3,4)+ date[i].substring(9,10) + date[i].substring(6,7); BigDecimal d2 = new BigDecimal(d1); byte[] asd2 = new AS400ZonedDecimal(6,0).toBytes(d2); BigDecimal bd1 = new BigDecimal(closingprice[i]); byte[] asbd1 = new AS400ZonedDecimal(15,5).toBytes(bd1); sqlstmt = "Insert into BLMINTF1 (" + field1 + "," + field2 + ")" + " values (" + asd2 + "," + asbd1 + ")"; System.out.println(sqlstmt); stmt.executeUpdate(sqlstmt); con.close(); When I run this pgm, I get an error during Insert statement. java.sql.SQLException: ^SQL0104] Token ^ was not valid. Valid tokens: ( + - ? : DAY RRN CASE CAST CHAR DAYS HOUR LEFT NULL TRIM U SER. java/lang/Throwable.<init>(Ljava/lang/String;)V+4 (Throwable.java:94) java/lang/Exception.<init>(Ljava/lang/String;)V+1 (Exception.java:42) java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:43) com/ibm/as400/access/JDError.throwSQLException(Lcom/ibm/as400/access/AS4 00JDBCConnection;III)V+0 (JDError.java:517) com/ibm/as400/access/AS400JDBCStatement.commonPrepare(Lcom/ibm/as400/acc ess/JDSQLStatement;)Lcom/ibm/as400/access/JDServerR ow;+0 (AS400JDBCStatement.java:920) Thanks for your help in advance, Rajesh Anand Email:Rajesh_anand@xxxxxx -------------------------------------------------------- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ --------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.