Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Java Toolkit for AS400

  Asked By: Dylan    Date: Jul 01    Category: Java    Views: 1349
  

Has anyone used the Java toolkit for AS400? I am having a problem
when I am trying to invoke a RPG program through a java application
that takes 5A paramter. It seems to work when I dont use a parameter
but when I try to use the parameter I get the following error: The
code is also below.

com.ibm.as400.access.InternalErrorException: Syntax error occurred.
com.ibm.as400.access.InternalErrorException: Syntax error occurred.
at
com.ibm.as400.access.RemoteCommandImplRemote.processReturnCode(Unknow
n Source)
at com.ibm.as400.access.RemoteCommandImplRemote.runProgram
(Unknown Sourc
e)
at com.ibm.as400.access.ProgramCall.run(Unknown Source)
at AS400Call.makeCall(AS400Call.java:56)
at AS400Call.main(AS400Call.java:26)



private void makeCall(){
try{

AS400 sys = new AS400(AS400Name,user,pass);
program = new ProgramCall(sys);


ProgramParameter[] parameterList = new ProgramParameter
[1];

// First parameter is to input a name.

AS400Text nametext = new AS400Text(5);
parameterList[0] = new ProgramParameter(nametext.toBytes
("DENIS"));


program.setProgram(pgm,parameterList);

// Run the program.
if (program.run() != true) {

// Report failure.
System.out.println("Program failed!");
// Show the messages.
AS400Message[] messagelist = program.getMessageList();
for (int i = 0; i < messagelist.length; ++i) {
// Show each message.
System.out.println(messagelist[i]);
}
}
// Else no error, get output data.
else {


AS400Message[] messageList = program.getMessageList();
System.out.println(messageList.length + " messages");
for (int i = 0; i < messageList.length; ++i) {
// Show each message.
System.out.println(messageList[i].getText());
// Load additional message information.
messageList[i].load();
//Show help text.
System.out.println(messageList[i].getHelp());
}

}
}
catch (Exception e) {
System.out.println("Program " + program.getProgram() + "
did not run!");
System.out.println(e);
e.printStackTrace();
}
}

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Java Toolkit for AS400 Or get search suggestion and latest updates.




Tagged: