mk
01-12-06, 10:48
Hallo zusammen,
vielleicht kann mir jemand auf die Sprünge helfen.
Das RPG Programm A_TESTR hat 3 Entry Parameter.
Parameter1 +2 sind Input Parameter und Parameter 3
ist der Outputparameter.
RPG A_TESTR
h
c *entry Plist
c Parm in_text1 10
c Parm in_text2 10
c Parm Out_text3 20
c eval Out_Text3 = In_text1 +
c In_Text2
c seton lr
Das Javaprogramm solle jetzt die Werte erhalten.
Leider bekomme ich immer die Fehlermeldung
Program /QSYS.LIB/MK.LIB/A_TESTR.PGM did not run!java.lang.NullPointerException: serverValue
da die Werte in parameterList auf null stehen.
Hat jemand eine Idee woran das liegen kann ?
Gruss
Michael
ProgramCall program = new ProgramCall(system);
try
{
// Initialize the name of the program to run.
String programName = "/QSYS.LIB/MK.LIB/A_TESTR.PGM";
// Set up the 3 parameters.
ProgramParameter[] parameterList = new ProgramParameter[3];
// First parameter is to input a name.
AS400Text In_parm1 = new AS400Text(10,system);
parameterList[0] = new ProgramParameter(In_parm1.toBytes("Ich bin"));
// Second parmeter is to get the answer, up to 50 bytes long.
AS400Text In_parm2 = new AS400Text(10,system );
parameterList[1] = new ProgramParameter(In_parm2.toBytes(" föl"));
// Third parmeter is to input a quantity and return a value up to 30 bytes long.
AS400Text Out_text3 = new AS400Text(20,system);
parameterList[2] = new ProgramParameter(Out_text3.toBytes(""));
// Set the program name and parameter list.
program.setProgram(programName, parameterList);
// Run the program.
if (program.run() != true)
{ System.out.println("Program failed!");
AS400Message[] messagelist = program.getMessageList();
for (int i = 0; i < messagelist.length; ++i)
{System.out.println(messagelist[i]); }
}else{
AS400Text text = new AS400Text(50,system);
System.out.println(text.toObject(parameterList[0].getOutputData()));
System.out.println(text.toObject(parameterList[1].getOutputData()));
System.out.println(text.toObject(parameterList[2].getOutputData()));
}
}
catch (Exception e)
{ System.out.println("Program " + program.getProgram() + " did not run!" + e ); }
system.disconnectAllServices();
}
}
vielleicht kann mir jemand auf die Sprünge helfen.
Das RPG Programm A_TESTR hat 3 Entry Parameter.
Parameter1 +2 sind Input Parameter und Parameter 3
ist der Outputparameter.
RPG A_TESTR
h
c *entry Plist
c Parm in_text1 10
c Parm in_text2 10
c Parm Out_text3 20
c eval Out_Text3 = In_text1 +
c In_Text2
c seton lr
Das Javaprogramm solle jetzt die Werte erhalten.
Leider bekomme ich immer die Fehlermeldung
Program /QSYS.LIB/MK.LIB/A_TESTR.PGM did not run!java.lang.NullPointerException: serverValue
da die Werte in parameterList auf null stehen.
Hat jemand eine Idee woran das liegen kann ?
Gruss
Michael
ProgramCall program = new ProgramCall(system);
try
{
// Initialize the name of the program to run.
String programName = "/QSYS.LIB/MK.LIB/A_TESTR.PGM";
// Set up the 3 parameters.
ProgramParameter[] parameterList = new ProgramParameter[3];
// First parameter is to input a name.
AS400Text In_parm1 = new AS400Text(10,system);
parameterList[0] = new ProgramParameter(In_parm1.toBytes("Ich bin"));
// Second parmeter is to get the answer, up to 50 bytes long.
AS400Text In_parm2 = new AS400Text(10,system );
parameterList[1] = new ProgramParameter(In_parm2.toBytes(" föl"));
// Third parmeter is to input a quantity and return a value up to 30 bytes long.
AS400Text Out_text3 = new AS400Text(20,system);
parameterList[2] = new ProgramParameter(Out_text3.toBytes(""));
// Set the program name and parameter list.
program.setProgram(programName, parameterList);
// Run the program.
if (program.run() != true)
{ System.out.println("Program failed!");
AS400Message[] messagelist = program.getMessageList();
for (int i = 0; i < messagelist.length; ++i)
{System.out.println(messagelist[i]); }
}else{
AS400Text text = new AS400Text(50,system);
System.out.println(text.toObject(parameterList[0].getOutputData()));
System.out.println(text.toObject(parameterList[1].getOutputData()));
System.out.println(text.toObject(parameterList[2].getOutputData()));
}
}
catch (Exception e)
{ System.out.println("Program " + program.getProgram() + " did not run!" + e ); }
system.disconnectAllServices();
}
}