Michael and Dave,
Thank you for your suggestions. The problem has been solved with iSphere v3.2.3.r.
The actual problem was improper usage of the DecimalFormat class with pattern "0000000000.00000". At a first glance that looks perfectly and it works fine for locales using a "dot" for the decimal comma. But DecimalFormat honors the current locale and when it is called, e.g. with a German locale, it formats the numeric value with a comma likes this: 0000000000,00000.
But that is not what the SQL CALL command expects for a numeric parameter.
I fixed the problem by using a CAST expression like this:
try {
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 + "', CAST(" + command.length() + " AS DECIMAL(15, 5)))";
statement.execute(command);
} catch (Exception e) {
String message = String.format("*** Could not overwrite database file %s ***", command);
ISpherePlugin.logErrorOnce(message, e);
throw new Exception(message, e);
}
Thomas.
-----Ursprüngliche Nachricht-----
Von: WDSCI-L [mailto:wdsci-l-bounces@xxxxxxxxxxxx] Im Auftrag von dlclark@xxxxxxxxxxxxxxxx
Gesendet: Montag, 19. Februar 2018 21:42
An: Rational Developer for IBM i / Websphere Development Studio Client for System i & iSeries
Betreff: Re: [WDSCI-L] iSphere - problem calling QSYS.QCMDEXC - Need help
"WDSCI-L" <wdsci-l-bounces@xxxxxxxxxxxx> wrote on 02/19/2018 03:34:20 PM:
We're on 7.1 and we do not have QSYS2.QCMDEXC. (Perhaps we haven't
installed something, but I'm doubtful of that.)
However, we get around the problem by defining a variable for the
command
string long enough to handle the longest string we anticipate needing
to
process. Then we move the actual command string into it which leaves
the
rest padded with blanks. after that, we simply call QCMDEXC with the
full
length of the field for the string passed as the second parameter.
QCMDEXC
doesn't care about the extra blanks on the end of the string.
A variable-length string is the best solution I came up with.
Works just like as in RPG except I don't think you can use the += operator
for complex concatenations. ;-)
Declare CmdStr VarChar(3000);
Declare CmdLen Decimal(15,5);
Set CmdStr = 'CALL UTSETLLCL (''' || CompNumb || ''' *FIRST)'; Set CmdLen = Length(CmdStr); Call QCMDEXC (CmdStr, CmdLen);
Sincerely,
Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300
Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331
*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary information. If you have received this message in error, please immediately notify the sender and delete and destroy the message and all copies. All unauthorized direct or indirect use or disclosure of this message is strictly prohibited. No right to confidentiality or privilege is waived or lost by any error in transmission.
*********************************************************************************************
--
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://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/wdsci-l.
--
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.