× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You might want to take a look at PCML and using the
com.ibm.as400.data.ProgramCallDocument. It's MUCH better to deal with.

It's been a while, but I'm pretty sure you can't use AS400Text for an
integer parameter. You have to use AS400Bin4.

So...
AS400Bin4 bin4 = new AS400Bin4();
byte[] b = bin4.toBytes(nextSequence);
parmList[1] = new ProgramParameter(b);

On a side note, in Java variables should always begin with a lowercase
letter.

String vanguardLocation = "WV";
Integer nextSequence = new Integer(0);

--
James R. Perkins
http://twitter.com/the_jamezp


On Tue, Oct 27, 2009 at 13:21, Loyd Goodbar <loyd@xxxxxxxxxxxxxx> wrote:

I am not a Java programmer so please be kind. :)

I have a simple Java program which calls a RPGLE program using ProgramCall
in JT400.jar. The call works (it increments a sequence number in a file),
but I am unsure how to retrieve the integer parameter after the call. The
program returns two DOS looking characters like a box corner and a diamond
or question mark. Using parseInt does not work, with error
"java.lang.NumberFormatException: For input String: "â?" "

Is this an EBCDIC ASCII translation issue? The character parameter shows
correctly in both the RPG and Java (testing in Windows). Am I even passing
(and receiving) the integer correctly? The called RPG program does run
because I see the sequence number increasing.

Java snippet:

String VanguardLocation;
Integer NextSequence;
VanguardLocation = "WV ";
NextSequence = 0;

// Create field types for parameters.
AS400Text txt5 = new AS400Text(5);
AS400Text txt4 = new AS400Text(4);

// Create parameter array and populate.
ProgramParameter[] parmList = new ProgramParameter[2];
parmList[0] = new ProgramParameter(
txt5.toBytes(VanguardLocation),5);
parmList[1] = new ProgramParameter(
txt4.toBytes(Integer.toString(NextSequence)),4);

// Set up program call and run.
ProgramCall pgm = new ProgramCall(sys,
"/QSYS.LIB/LG.LIB/INCGLJSEQ.PGM", parmList);
if (pgm.run() != true) {
AS400Message[] messageList = pgm.getMessageList();
} else {
System.out.println("Output Data 0: " +
(String)txt5.toObject( parmList[0].getOutputData() ) );
System.out.println("Output Data 1: " +
(String)txt4.toObject( parmList[1].getOutputData() ) );
sys.disconnectService(AS400.COMMAND);
}

The output:

Output Data 0: WV
Output Data 1: â?

I am expecting a number around 25658 (that would be the next sequence
number
from the file).

The RPG prototype:

d incgljseq pr extpgm('INCGLJSEQ')
d inlocation 5a const
d outuseseq 10i 0


Any info to help this Java newbie out is appreciated!

Thanks,
Loyd
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



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.