`
javathinker
  • 浏览: 227739 次
  • 来自: ...
文章分类
社区版块
存档分类
最新评论

Java 调用 Rexx Java Call Rexx In ZOS MVS

 
阅读更多

java - Rexx的要求

It's more complicated.它更复杂。 Before using the Runtime.getRuntime().exec() method, you must first get the name of your Operating System.在使用Runtime.getRuntime()。exec()方法,您必须先得到您的操作系统的名称。 According you OS, you have to prefix the Rexx script name.根据您的操作系统,你必须前缀Rexx脚本的名称。 For example, in a Linux/Unix shell, if you want to call the "myscript.rexx", you have to type on the command line "./myscript.rexx".例如,在Linux / Unix的外壳,如果你想调用“myscript.rexx”,你必须在命令行“键入。/ myscript.rexx”。 In the java application, you have to do the same thing like :在Java应用程序,你必须做同样的事情一样:

// Getting Operating System name
String OS = System.getProperty("os.name").toLowerCase();

// Name of the Rexx to be executed
String cmd = "hello.rexx";

// Prepearing the command according to the Operating System
if (OS.indexOf("windows 9") > -1) {
cmd = "command.com /c " + cmd;
}
else if ( (OS.indexOf("nt") > -1)
|| (OS.indexOf("windows 2000") > -1 )
|| (OS.indexOf("windows xp") > -1) ) {
cmd = "cmd.exe /c " + cmd;
}
else {
cmd = "./" + cmd;
}

Don't forget the extension ".rexx" to the script name !!! 不要忘记扩展名为“。Rexx的”到脚本的名称!

You may also want to capture the command output by opening an input stream :您可能还希望抓住开放的输入流命令的输出:

String line;
Process p = Runtime.getRuntime().exec(cmdline);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));

// Reading the output messages of the command
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();


If you want a full example (Rexx calling Java and Java calling Rexx), download this file如果你想要一个完整的例子(Rexx的调用Java和Java调用Rexx中),下载这个文件
----------------------
是否可以调用一个REXX(编译或不)从Java程序运行在z / OS的?
We have a new java program and want to leverage an existing rexx script.
我们有一个新的Java程序并希望利用现有的Rexx脚本。 Passing parms and getting data and status back is important. 传递参数和获得数据和状态回是重要的。

Thanks

John
------回复如下
It is fairly easy to invoke a REXX script if it is run as az/OS Unix REXX script (stored in the HFS/zFS filesystem, without using the TSO command environment). 这是很容易调用REXX脚本如果是宰运行/操作系统Unix的REXX脚本(在居所资助计划不使用存储曹命令环境/ ZFS的文件系统)。

There are several examples of doing this in the IBM JZOS Sample code. 要做到在IBM JZOS示例代码这几个例子。 Look at the following classes in the com.ibm.jzos.sample package: 在下面的类查找在com.ibm.jzos.sample包:

MvsJobOutput MvsJobOutput
MvsJobSubmitter MvsJobSubmitter

The JZOS sample source code is available here: 在JZOS示例源代码可以在这里:
http://www-03.ibm.com/servers/eserver/zseries/software/java/products/jzos/overview.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics