忙于尝试Call RPG function from Java得到了this来自 JamesA 的示例.但是现在我遇到了麻烦,这是我的代码:
AS400 system = new AS400("MachineName");
ProgramCall program = new ProgramCall(system);
try
{
// Initialise the name of the program to run.
String programName = "/QSYS.LIB/LIBNAME.LIB/FUNNAME.PGM";
// Set up the 3 parameters.
ProgramParameter[] parameterList = new ProgramParameter[2];
// First parameter is to input a name.
AS400Text OperationsItemId = new AS400Text(20);
parameterList[0] = new ProgramParameter(OperationsItemId.toBytes("TestID"));
AS400Text CaseMarkingValue = new AS400Text(20);
parameterList[1] = new ProgramParameter(CaseMarkingValue.toBytes("TestData"));
// Set the program name and parameter list.
program.setProgram(programName, 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
{
AS400Text text = new AS400Text(50);
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() + " issued an exception!");
e.printStackTrace();
}
// Done with the system.
system.disconnectAllServices();
应用程序在这一行挂起if (program.run() != true)
,我等待了大约 10 分钟,然后终止了应用程序。
知道我做错了什么吗?
编辑
这是作业日志中的消息:
Client request - run program QSYS/QWCRTVCA.
Client request - run program LIBNAME/FUNNAME.
File P6CASEL2 in library *LIBL not found or inline data file missing. Error message CPF4101 appeared during OPEN.
Cannot resolve to object YOBPSSR. Type and Subtype X'0201' Authority
FUNNAME 通过名为 P6CASEL2 的 View 向表 P6CASEPF 中插入一行。 P6CASEL2 在不同的库中,可以说是 LIBNAME2。是否可以设置 JobDescription?
最佳答案
您确定 FUNNAME.PGM
正在终止并且没有挂起 MSGW 吗?检查 QSYSOPR
是否有任何消息。
Class ProgramCall :
NOTE: When the program runs within the host server job, the library list will be the initial library list specified in the job description in the user profile.
关于Java ProgramCall.run 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16708111/