Maybe you could try the version of this procedure in QSYS2 which doesn't required the length parameter...

call qsys2.qcmdexc('addlible mylib')

Tim.

________________________________
From: WDSCI-L <wdsci-l-bounces@xxxxxxxxxxxx> on behalf of Sune Elvig <sune.elvig@xxxxxxx>
Sent: 16 February 2018 10:48
To: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries
Subject: Re: [WDSCI-L] iSphere - problem calling QSYS.QCMDEXC - Need help

Hi Thomas

Now that I see the java code, I realise why I am having problems with the
command.

The issue is related to the locale of my PC. decimalFormatter is
formatting the decimal number with a comma and not a period. When the
statement is the executed on the server, then the statment looks like this:

CALL QSYS.QCMDEXC('OVRDBF FILE(WOPHDRS14C) TOFILE(RADDATZ/WOPHDRS14C)
MBR(*FIRST) OVRSCOPE(*JOB)', 0000000077,00000); (with a comma) and

the statement should be formatted like this

CALL QSYS.QCMDEXC('OVRDBF FILE(WOPHDRS14C) TOFILE(RADDATZ/WOPHDRS14C)
MBR(*FIRST) OVRSCOPE(*JOB)', 0000000077.00000); (with a period).

That also explains why you could not replicate the error, since you are
using another locale.

Br
Sune





On 16 February 2018 at 08:48, Thomas Raddatz <thomas.raddatz@xxxxxx> wrote:

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://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsourceforge.net%2Fp%2Fisphere%2Fdiscussion%2Fgeneral%2Fthread%2F88326bf6%2F&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=DvTksOYtns2uThzsv%2Bkk9xz8CkrxpkT%2FE%2Fa64J3Uq9Y%3D&reserved=0

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.
--
This is the Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fwdsci-l&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=OvfWipl7rg4%2FJZHr6P2FaShtxQxtYfNwnUfGjikhlOY%3D&reserved=0
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fwdsci-l&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=gf%2FLa2M%2BG3uSMqa6Xewsgt3qypUl%2BWYlmfb3b059CZE%3D&reserved=0.




--
Med venlig hilsen,
Best regards,

*Sune Elvig*
Application Manager DBS

IT Competence Center PEPP
Baltorpbakken 14 | 2750 Ballerup | Denmark
*M *+45 20 75 99 31
*E *sune.elvig@xxxxxxx | *I **https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pon-cat.com&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=r6aXqwrGjbjiqJYmzuPZpL%2B3xLFBz%2F12VMt0diU%2Ffr8%3D&reserved=0*
<https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.pon-cat.com%2F&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=76JekWL2gJaZrZXjO2yxN1uX1ADFZqPo3EtL3mkggWw%3D&reserved=0>
………………………………………………………………………………………


_______________________________________________________________________

Please consider the environment before printing this e-mail

--
The information sent with this e-mail message is intended exclusively for
the addressee[s] and may contain personal and/or confidential information,
protected by professional confidentiality. Use of this information by
people other than the addressee[s] and use by those who are not entitled to
peruse this information, is forbidden. If you are not the addressee or are
not entitled to peruse this information, publication, reproduction,
distribution and/or provision of this information to third parties is not
permitted and you are asked to return this message and to destroy the
original..

Our general conditions apply to the services we provide in which a
restriction of our liability is included. On your first request a copy will
be sent to you free of charge.
--
This is the Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fwdsci-l&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=OvfWipl7rg4%2FJZHr6P2FaShtxQxtYfNwnUfGjikhlOY%3D&reserved=0
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fwdsci-l&data=02%7C01%7C%7C7b2256dc45434d83302b08d5753cc3c1%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636543826192038029&sdata=gf%2FLa2M%2BG3uSMqa6Xewsgt3qypUl%2BWYlmfb3b059CZE%3D&reserved=0.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.