1828332 Members
5085 Online
109976 Solutions
New Discussion

Executing DCL from Java

 
SOLVED
Go to solution
Jeremy Begg
Trusted Contributor

Executing DCL from Java

Hi,

I've installed a Java application on an HP Integrity rx2660 server running VMS 8.3-1H1 and the latest Java SDK. The application (a commercial e-commerce product) was not developed with VMS in mind and we are this vendor's first VMS customer.

The application has the ability to "run a shell command on receipt of a file" and so I configured it to run a SUBMIT command. However it fails with this error:

"Child creation error: no such file or directory"

The vendor tells me the DCL command is invoked using Runtime.exec() but I know nothing about Java. Where can I find a description of how Runtime.exec() works on VMS?

FYI the Java application runs as a batch job under a specific username. The SUBMIT command in question works fine when invoked by that user interactively.

Thanks,
Jeremy Begg
3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: Executing DCL from Java

A quick Google search for:
java Runtime.exec vms OR openvms
led reasonable easily to:

http://h18012.www1.hp.com/java/documentation/
http://h18012.www1.hp.com/java/documentation/1.4.2/ovms/docs/user_guide.html
http://h18012.www1.hp.com/java/documentation/1.4.2/ovms/docs/user_guide.html#workingwruntimeexec

I quote:

[...]
Asking a Java program to exec a DCL verb like DIR does not work.

Workaround:
[...]
Jeremy Begg
Trusted Contributor

Re: Executing DCL from Java

Thanks! I found the same information about 20 minutes after writing my query.
x2084
Trusted Contributor

Re: Executing DCL from Java

Answered before, see threadId=1226409. Another workaround (costs one more process) is to use DCL.EXE from GNV and have that in your path.

$ ty dcl.java
import java.io.*;
public class DCL {

public static void main(String argv[]) {
try {
String cmd[] = {"dcl.exe", "dir", "/since", "dcl*"};
String line;
Process p = Runtime.getRuntime().exec (cmd);
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
}
catch (Exception err) {
err.printStackTrace();
}
}
}
$ javac dcl.java
$ java "DCL

Directory SYS$SYSDEVICE:[HARTMUT]

DCL.CLASS;1 DCL.JAVA;1

Total of 2 files.
$