| 
 | 
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
**************************************************************************************************
The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or 
the 
sender immediately and do not disclose the contents to anyone or make copies.
** eSafe scanned this email for viruses, vandals and malicious content **
**************************************************************************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.