Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Limit to DCL parameter string size for Java Runtime.exec()

 
Jonathan O'Donovan
Occasional Contributor

Limit to DCL parameter string size for Java Runtime.exec()

I am using Java 1.5 Runtime.exec() to call DCL script as follows (below). I have noticed that it fails for parameter strings longer than roughly 215 characters. Does anyone know if there is a way to increase the number of characters that Runtime.exec() can handle ?

package XXX.filerelease;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.log4j.Logger;

public class FileReleaseVmsImpl implements FileReleaseIntf{
private String DUMMYEMAIL = "\"Test@test.com\"";
public String searchForFiles(FileReferenceVmsImpl fileReference) {
String result = "";

String command = "findme.com"
+ " " + DUMMYEMAIL
+ " " + fileReference.getFormattedDateString()
+ " " + fileReference.getBatch()
+ " " + fileReference.getSequence();

Runtime run = Runtime.getRuntime();
Process pr;
try {
pr = run.exec(command);
BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = "";
while ((line = buf.readLine()) != null) {
result += line + "\n";
}
} catch (IOException e) {
result = MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_VMS_ERROR;
return (result);
}
return result;
}
}

4 REPLIES 4
P Muralidhar Kini
Honored Contributor

Re: Limit to DCL parameter string size for Java Runtime.exec()

Hi Jonathan,

>> I have noticed that it fails for parameter strings longer than
>> roughly 215 characters.
What error message are you getting ?

Discussion on a similar problem -
http://unix.derkeiler.com/Newsgroups/comp.os.vms/2004-12/1375.html

Regards,
Murali
Let There Be Rock - AC/DC
Jonathan O'Donovan
Occasional Contributor

Re: Limit to DCL parameter string size for Java Runtime.exec()

Thanks - I have seen that post - the error message I get is

%DCL-W-NOLBLS, label ignored - use only within command procedures
\_MBA26400:\
%DCL-W-NOCOMD, no command on line - reenter with alphabetic first character


Actually, I am using a dcl wrapper file as described here : http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1434352

to invoke a second .com file. The wrapper .com file does not get invoked because the DCL command string is too long. Once it is shortened a little, the wrapper is called correctly and all works fine.
P Muralidhar Kini
Honored Contributor

Re: Limit to DCL parameter string size for Java Runtime.exec()

Hi Jonathan,

Looks like the logical "JAVA$ENABLE_ENVIRONMENT_EXPANSION" might
help solve your problem.

Refer the following link -
http://sh.ncsd.k12.ca.us/java-docs/release_notes.html#javaenableenvironmentexp
-> Section "Using JAVA$ENABLE_ENVIRONMENT_EXPANSION"

Check if this is applicable in your case.

Hope this helps.

Regards,
Murali
Let There Be Rock - AC/DC
H.Becker
Honored Contributor

Re: Limit to DCL parameter string size for Java Runtime.exec()

Did
$ define/job JAVA$EXEC_TRACE true
give you some insight? If that has no effect, you may want to try
$ set verify
before starting Java.

As already implicitly explained, java passes the command string to the spawned process via a mailbox. But before invoking your wrapper command file, there are Java generated define-commands for some process permanent files. With one of these settings you should be able to see them.

You may get some insight in how the mailbox is used and whether that is the same mailbox you see in the error message.