Hi,
I really could need some help figuring out the actual problem. The problem is that one user (so far) cannot execute the following commands on his system:
CALL QSYS.QCMDEXC('OVRDBF FILE(WOPHDRS14C) TOFILE(RADDATZ/WOPHDRS14C) MBR(*FIRST) OVRSCOPE(*JOB)', 0000000077.00000);
CALL QSYS.QCMDEXC('DLTOVR FILE(WOPHDRS14C) LVL(*JOB)', 0000000033.00000);
The error returned is: SQLCODE -443, Command too long (CPD0005).
Using QSYS2.QCMDEXC works to our surprise.
Please find all the details in the following iSphere discussion at SourceForge:
https://sourceforge.net/p/isphere/discussion/general/thread/88326bf6/
The Java code in question is:
/**
* Executes a OVRDBF statement likes this:
*
* <pre>
* OVRDBF FILE(OVRFILE) TOFILE(LIBRARY/FILE) MBR(MEMBER) OVRSCOPE(*JOB)
* </pre>
*
* @param statement - SQL statement for executing the CL command
* @param toFile - file that is overwritten
* @param library - library the contains the file that is actually used
* @param file - file that is actually used
* @param member - member that is actually used
* @throws Exception
*/
private void overwriteDatabaseFile(Statement statement, String toFile, String library, String file, String member) throws Exception {
String command = String.format("OVRDBF FILE(%s) TOFILE(%s/%s) MBR(%s) OVRSCOPE(*JOB)", outputFile.getOutFileName(),
outputFile.getOutFileLibrary(), outputFile.getOutFileName(), outputFile.getOutMemberName());
command = "CALL QSYS.QCMDEXC('" + command + "', " + decimalFormatter.format(command.length()) + ")";
statement = createStatement();
statement.execute(command);
}
/**
* Executes a DLTOVR statement likes this:
*
* <pre>
* DLTOVR FILE(OVRFILE) LVL(*JOB)
* </pre>
*
* @param statement - SQL statement for executing the CL command
* @param toFile - file, whose overwrite is removed
*/
private void deleteDatabaseOverwrite(Statement statement, String toFile) {
String command = null;
try {
command = String.format("DLTOVR FILE(%s) LVL(*JOB)", toFile);
statement.execute("CALL QSYS.QCMDEXC('" + command + "', " + decimalFormatter.format(command.length()) + ")");
} catch (Exception e) {
if (!loggedCommand.contains(command)) {
loggedCommand.add(command);
ISpherePlugin.logError(String.format("*** Could not delete database overwrite %s ***", command), e);
}
}
}
"Statement" is a java.sql.Statement create like this:
private Connection produceJDBCConnection(IBMiConnection ibmiConnection, Properties properties) {
Connection jdbcConnection = null;
AS400JDBCDriver as400JDBCDriver = null;
try {
try {
as400JDBCDriver = (AS400JDBCDriver)DriverManager.getDriver("jdbc:as400");
} catch (SQLException e) {
as400JDBCDriver = new AS400JDBCDriver();
DriverManager.registerDriver(as400JDBCDriver);
}
AS400 system = ibmiConnection.getAS400ToolboxObject();
jdbcConnection = as400JDBCDriver.connect(system, properties, null);
addConnectionToCache(ibmiConnection, properties, jdbcConnection);
} catch (Throwable e) {
}
return jdbcConnection;
}
Any ideas will be greatly appreciated.
Thanks,
Thomas.
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender.
As an Amazon Associate we earn from qualifying purchases.