My guess is you've got CCSID conversion issues.

According to the javadocs, the constructor AS400Text(int) is deprecated.
You should use AS400Text(int, AS400). That constructor will use the CCSID
of the AS/400 system you are connected to.

===
Marshall Dunbar
DPS, Inc.
====



Ewout N Boter <ewout.boter@xxxxxxxxxx>
Sent by: java400-l-bounces@xxxxxxxxxxxx
09/28/2007 10:19 AM
Please respond to
Java Programming on and around the iSeries / AS400
<java400-l@xxxxxxxxxxxx>


To
java400-l@xxxxxxxxxxxx
cc

Subject
ProgramParameter does not pass value correctly - revisited






A week ago, I posted the below message. Unfortunately, I did not get a
reply. Today, I picked up this problem again. I have done all kinds of
experiments, but again to no avail. I am afraid I will start the weekend
feeling very frustrated. (I'm in Europe, so it's somewhat later here, and
the weekend is about to start, which should normally make me happy.) I
repeat my previous e-mail, hoping this time someone can provide a
solution.

Have a good weekend! (Ok, after all, I think I will enjoy the weekend
too.)

----------------------------------------------------------

I am very confused. I want to call a service program from Java. The Java
code looks like this:

public boolean login() throws LoginException {

ServiceProgramCall sPGMCall = null;
AS400 system = null;
AS400Text txtCnv = new AS400Text(10);

try {
ProgramParameter[] parameterList = new
ProgramParameter[1];
parameterList[0] = new
ProgramParameter(txtCnv.toBytes(check_program));
AS400.setPasswordExpirationWarningDays(-1);
system = new AS400(auth_server, user, password);
sPGMCall = new ServiceProgramCall(system);
QSYSObjectPathName fullSrvPgmName = new
QSYSObjectPathName("%LIBL%", "ALSRVWRP", "SRVPGM");
sPGMCall.setProgram(fullSrvPgmName.getPath(),
parameterList);
sPGMCall.setProcedureName("AUTHORIZED_PGM_WRP");
sPGMCall.setReturnValueFormat(ServiceProgramCall.RETURN_INTEGER);
if (sPGMCall.run() != true) {
AS400Message[] messageList =
sPGMCall.getMessageList();
[......]

I copied this setup (defining an AS400Text object, and using method
toBytes on that object to define the parameter) from numerous pages on the

internet. However, when I do a debug on service program ALSRVWRP, all I
see is gibberish (some ASCII characters way out of the normal range).

What on earth is wrong with this code?

Ewout

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.