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



Jessica,

If you set the CommandCall to be thread safe it should work OK as long
as the commands are thread safe. Try something like:

        CommandCall commandCall = new CommandCall(as400);
        commandCall.setThreadSafe(isThreadSafe());

For a more complete example see:

http://cvs.sourceforge.net/viewcvs.py/iseries-toolkit/iseries-toolkit/src/java/org/iseriestoolkit/ant/OS400Command.java?only_with_tag=MAIN&view=markup

David Morris

>>> jking@xxxxxxxxxxxxxx 08/19/04 12:41 PM >>>
I'm trying to call a CL using QCMDEXC and cannot figure out where my
error
is coming from.

 

Code:

AS400 sys = new AS400(system,userId,password);

AS400JDBCDataSource d = new AS400JDBCDataSource(sys);

Connection connection = d.getConnection();

Statement statement = connection.createStatement();

String commandCall = "CLSITE01";

java.text.DecimalFormat formatter = new
java.text.DecimalFormat("0000000000.00000");

String formattedLength = formatter.format((double)commandCall.length());

String strSQL = "CALL QSYS.QCMDEXC ("; //beginning of string

strSQL = strSQL + "'" + commandCall+ "'";//command call in single quotes

strSQL = strSQL + "," + formattedLength + ")";

System.out.println("Attempting to run sql: " + strSQL);

try {

    // Run the command

    boolean successful = statement.execute(strSQL);
     //that was line 374

}.

 

Output:

Attempting to run sql: CALL QSYS.QCMDEXC ('CLSITE01',0000000008.00000)

SQL issued an exception!

SQLState: 38501

java.sql.SQLException: [CPF0006] Errors occurred in command.

        at
com.ibm.as400.access.JDError.throwSQLException(JDError.java:594)

        at
com.ibm.as400.access.JDError.throwSQLException(JDError.java:565)

        at
com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.jav
a:1269)

        at
com.ibm.as400.access.AS400JDBCStatement.execute(AS400JDBCStatement.java:1606
)

        at
com.phelon.Global.AS400.CommandRunner.main(CommandRunner.java:374)

 

The command executes fine on the AS400 and even works when I use the
CommandCall object in JTOpen. However, the command creates a table in
QTEMP,
and if I use a CommandCall object, the table isn't there when I go back
for
it using SQL. Any ideas?

 

Thanks,

Jessica

Client/Server Programmer

MPS-Phelon


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.