Java Can';t从DSPLIBL(as400.access软件包)接收输出
我正在尝试使用java连接到AS/400服务器,并希望运行一些简单的命令 我的进口是:Java Can';t从DSPLIBL(as400.access软件包)接收输出,java,ibm-midrange,Java,Ibm Midrange,我正在尝试使用java连接到AS/400服务器,并希望运行一些简单的命令 我的进口是: import com.ibm.as400.access.AS400; import com.ibm.as400.access.AS400Message; import com.ibm.as400.access.CommandCall; 这就是我迄今为止所做的: AS400 as400 = null; Scanner scanner = new Scanner(Syst
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Message;
import com.ibm.as400.access.CommandCall;
这就是我迄今为止所做的:
AS400 as400 = null;
Scanner scanner = new Scanner(System.in);
try {
as400 = new AS400(host);
as400.setUserId(user);
as400.setPassword(pass);
CommandCall cmd = new CommandCall(as400);
while(true) {
System.out.println("Ready for input, type \"quit\" to end session");
String commandStr = scanner.nextLine();
System.out.println("Command entered: " + commandStr);
if(commandStr.equals("quit")) {
break;
}
System.out.println("Executing: " + commandStr);
boolean success = cmd.run(commandStr.toUpperCase());
System.out.println("Finished execution");
if (success) {
System.out.println("Command Executed Successfully.");
}else{
System.out.println("Command Failed!");
}
// Get the command results
System.out.println("Getting output");
AS400Message[] messageList;
messageList = cmd.getMessageList();
for (AS400Message message : messageList){
System.out.println(message.getText());
}
}
}catch(UnknownHostException uh){
System.out.println("Unknown host");
}catch(Exception e) {
e.printStackTrace();
}finally{
scanner.close();
try {
as400.disconnectAllServices();
}catch(Exception e) {}
}
然而,当我尝试运行DSPLIBL时:我得到一个空白输出
Ready for input, type "quit" to end session
dsplibl
Command entered: dsplibl
Executing: dsplibl
Finished execution
Command Executed Successfully.
Getting output
Ready for input, type "quit" to end session
然而,其他一切似乎都很好。CRTLIB库名称工作正常,并返回一条输出消息。无效命令还返回消息,说明输入无效。只是DSPLIBL没有给我一个输出
有什么不对的想法吗?特别提到了命令调用
允许使用Java™ 调用非交互式IBM®i命令的程序
DSPLIBL是一个交互式命令
您为CRTLIB成功返回的“输出”是该命令返回的完成消息
查看基于DSPLIBL文档的“显示输出(如果交互式作业请求)或打印作业的假脱机输出(如果批处理作业请求)。”,我想知道假脱机输出文件是否会出现在某个输出队列中(类似于使用*PRINT参数得到的结果)当原始程序以这种方式调用DSPLIBL时。@迈克,我相信你是对的……它会用库列表创建一个spool文件。