Hi Loyd,

I understand you are a Java newbie, and there may be other reasons you are doing things this way. But, if the only thing that is happening is working with a file, you might consider using JDBC instead of calling a program in another language to handle file/table manipulation. That has the additional benefit of exposing you to SQL, which can also be used in RPG and most other languages, if you haven't used it before. There are lots of tutorials on the net.

It likely doesn't matter in this case, but you end up with data manipulation portability ( dependent on the extent you stay away from proprietary "features" ) as well as code portability. I just completed a project that required both DB2/400 and SQL Server. The SQL is completely separated into a ResourceBundle, and the only changes needed to move from one database engine to another is the table creation ( mostly because I'm using what amounts to a field reference table, ) and plus ( + ) versus vertical bars ( || ) for concatenation.

Joe Sam

Joe Sam Shirah - http://www.conceptgo.com
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International? http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400

----- Original Message ----- From: "Loyd Goodbar" <loyd@xxxxxxxxxxxxxx>
To: <java400-l@xxxxxxxxxxxx>
Sent: Tuesday, October 27, 2009 4:21 PM
Subject: Retrieving integer parameter after JT400 ProgramCall?

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(
parmList[1] = new ProgramParameter(

// Set up program call and run.
ProgramCall pgm = new ProgramCall(sys,
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() ) );

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!


This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page