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



You'll need to make sure that you pad all parameters to length that they
are defined in the target program.  I use a simple utility class to pad
fields left/right with blanks or zeroes.

-----Original Message-----
From: java400-l-bounces+tkosacek=visioninfo.com@xxxxxxxxxxxx
[mailto:java400-l-bounces+tkosacek=visioninfo.com@xxxxxxxxxxxx] On
Behalf Of P.Goovaerts@xxxxxxxxxx
Sent: Thursday, March 20, 2003 11:35 AM
To: java400-l@xxxxxxxxxxxx
Subject: Re: JAVA400-L Digest, Vol 1, Issue 631


Thank you all!

although I got another problem now:
When I execute 
        stmt.executeUpdate("CALL MYPGM('parm1')";
where 
        parm1="xxxxxxxxxx               "
it seems that the trailing spaces are left out at execution_time.... 

The CL/RPG program receives: "xxxxxxxxxx???????????????"
where ??...?? is 'rubbish' in stead of spaces.
Because the application checks if that part is blank
it goes wrong.

To be complete, the parameter is in fact a bit longer 
(first 15 chars are filled, next 350chars are a list
of 10-35char fields which sometimes contain data, sometimes not!



>> date: Tue, 18 Mar 2003 10:12:08 -0500
>> from: "Tim Kosacek" <tkosacek@xxxxxxxxxxxxxx>
>> subject: RE: how to submit a job on iSeries from webapplication
>> 
>> This is off the top of my head, so hopefully the syntax would be 
>> correct!
>> 
>> Hopefully this formats OK,
>> 
>> import java.sql.Connection;
>> import java.sql.DriverManager;
>> import java.sql.SQLException;
>> import java.sql.Statement;
>> 
>> public class TestProgramCallJDBC
>> {
>> 
>>               public static void main(String[] args)
>>               {
>>                               Connection con = null;
>>                               Statement stmt = null;
>>                               try
>>                               {
>> 
>> Class.forName("com.ibm.as400.access.AS400JDBCDriver");
>>                                               con = 
>> DriverManager.getConnection("jdbc:as400://mysystem/mylibrary",
>>                                                 "myuser",
"mypassword");
>>                                               stmt =
con.createStatement();
>>                                               
>> stmt.executeUpdate("CALL MYPGM('parm1','parm2','parm3'");
>>                               }
>>                               catch (Exception e)
>>                               {
>>                                               e.printStackTrace();
>>                               }
>>                               finally
>>                               {
>>                                               if (stmt != null)
>>                                               {
>>                                                               try
>>                                                               {  
>> stmt.close();
>>                                                               }
>>                                                               catch
(SQLException e)
>>                                                               {  
>> e.printStackTrace();
>>                                                               }
>>                                               }
>>                                               if (con != null)
>>                                               {
>>                                                               try
>>                                                               {  
>> con.close();
>>                                                               }
>>                                                               catch
(SQLException e)
>>                                                               {  
>> e.printStackTrace();
>>                                                               }
>>                                               }
>>                               } 
>>               }
>> }
>> 
>> Just substitute how you get the connection, and the program you want 
>> to call.  Hopefully this helps.
>> 
>> Tim
_______________________________________________
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.