× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



        Thanks Ron,

        Its worked, but I'm confused as ever.

        When would you change from java types to as400 types as we
didn't have to change on this occasion???

        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:44
To: Java Programming on and around the iSeries / AS400
Subject: RE: Error when converting Java Types to AS400 data Types


Ah ok.
I think I might see your problem.  Give this a try, build your "values"
as 
just strings and see what happens.  I've built my SQL statements for the

DB2 when accessing zone fields as just strings and it seems to be fine. 
ie.
        String civicno;
        String unit;
        String street;

                        civicno = req.getParameter("civicno").trim();
                        unit = req.getParameter("unit").trim();
                        street = req.getParameter("street").trim();
                        getCustomers =
                                conn.prepareStatement(
                                        "SELECT * FROM "
                                                + collectionName
                                                + 
dmd.getCatalogSeparator()
                                                + custTable
                                                + " WHERE WCSTREET# = "
                                                + street
                                                + " AND WCCIVIC# = '"
                                                + civicno
                                                + "'");

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 02:00 PM
Please respond to
Java Programming on and around the iSeries / AS400 
<java400-l@xxxxxxxxxxxx>


To
"Java Programming on and around the iSeries / AS400" 
<java400-l@xxxxxxxxxxxx>
cc

Subject
RE: Error when converting Java Types to AS400 data Types






                 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 thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.