<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645215#M40033</link>
    <description>Thanks to all for the great help offered - I am really impressed by this forum! As suggested, I have used a wrapper .com file as follows to solve the problem : &lt;BR /&gt;&lt;BR /&gt;java_dcl_wrapper.com : &lt;BR /&gt;&lt;BR /&gt;$ @'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'&lt;BR /&gt;&lt;BR /&gt;I have used up to 8 parameters just so that I can reuse this wrapper for any .com file that needs to be invoked from Runtime.exec().&lt;BR /&gt;&lt;BR /&gt;Now my FileReleaseVmsImpl class looks as follows : &lt;BR /&gt;&lt;BR /&gt;package ie.interfusion.portal.business.remote.filerelease;&lt;BR /&gt;&lt;BR /&gt;import ie.interfusion.portal.business.MHConstants;&lt;BR /&gt;&lt;BR /&gt;import java.io.BufferedReader;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.io.InputStreamReader;&lt;BR /&gt;&lt;BR /&gt;import org.apache.log4j.Logger;&lt;BR /&gt;&lt;BR /&gt;public class FileReleaseVmsImpl implements FileReleaseIntf{&lt;BR /&gt; static Logger log = Logger.getLogger("ie.interfusion.portal.rmi.RmiFileRelease");&lt;BR /&gt; private String DUMMYEMAIL = "\"Test@test.com\"";&lt;BR /&gt; public String searchForFiles(FileReferenceVmsImpl fileReference) {&lt;BR /&gt;  String result = "";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  String[] command = {&lt;BR /&gt;    MHConstants.JAVA_DCL_WRAPPER,    &lt;BR /&gt;    MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST, &lt;BR /&gt;    DUMMYEMAIL,&lt;BR /&gt;    fileReference.getFormattedDateString(),&lt;BR /&gt;    fileReference.getBatch(),&lt;BR /&gt;    fileReference.getSequence()&lt;BR /&gt;   }; &lt;BR /&gt;&lt;BR /&gt;  log.info("Searching for file: " + fileReference);&lt;BR /&gt;  Runtime run = Runtime.getRuntime();&lt;BR /&gt;  Process pr;&lt;BR /&gt;  try {&lt;BR /&gt;   pr = run.exec(command);&lt;BR /&gt;   BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));&lt;BR /&gt;   String line = "";&lt;BR /&gt;   while ((line = buf.readLine()) != null) {&lt;BR /&gt;    result += line + "\n";&lt;BR /&gt;   }&lt;BR /&gt;  } catch (IOException e) {&lt;BR /&gt;   result = MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_VMS_ERROR;&lt;BR /&gt;   log.error(e.getMessage());&lt;BR /&gt;   return (result);&lt;BR /&gt;  }&lt;BR /&gt;  return result;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The values of the MHConstants strings are as follows : &lt;BR /&gt;&lt;BR /&gt;public static final String JAVA_DCL_WRAPPER = "XXX:[java]java_dcl_wrapper.com";&lt;BR /&gt;public static final String FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST = "XXX:[JAVA]findme2.com";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that it seems that you have to put the '@' in the wrapper .com file - I get a &lt;BR /&gt;&lt;BR /&gt;%DCL-W-NOCOMD, no command on line - reenter with alphabetic first character &lt;BR /&gt;&lt;BR /&gt;error returned if I omit the '@' from the wrapper and instead put it in the FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST string as follows : &lt;BR /&gt;&lt;BR /&gt;public static final String FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST = "@XXX:[JAVA]findme2.com";&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 10 Jun 2010 09:49:10 GMT</pubDate>
    <dc:creator>Jonathan O'Donovan</dc:creator>
    <dc:date>2010-06-10T09:49:10Z</dc:date>
    <item>
      <title>.com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645209#M40027</link>
      <description>Hi, &lt;BR /&gt;I am trying to use java to invoke a dcl .com file which takes 4 parameters. &lt;BR /&gt;&lt;BR /&gt;This file is working properly when invoked from the command line, as follows : &lt;BR /&gt;&lt;BR /&gt;$@findme.com p1 p2 p3 p4&lt;BR /&gt;&lt;BR /&gt;When I use java.lang.Runtime as follows there is a problem : &lt;BR /&gt;&lt;BR /&gt;package XXX.filerelease;&lt;BR /&gt;import java.io.BufferedReader;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.io.InputStreamReader;&lt;BR /&gt;&lt;BR /&gt;import org.apache.log4j.Logger;&lt;BR /&gt;&lt;BR /&gt;public class FileReleaseVmsImpl implements FileReleaseIntf{&lt;BR /&gt; private String DUMMYEMAIL = "\"Test@test.com\"";&lt;BR /&gt; public String searchForFiles(FileReferenceVmsImpl fileReference) {&lt;BR /&gt;  String result = "";&lt;BR /&gt;&lt;BR /&gt;  String command = "findme.com" &lt;BR /&gt;  + " " + DUMMYEMAIL&lt;BR /&gt;  + " " + fileReference.getFormattedDateString()&lt;BR /&gt;  + " " + fileReference.getBatch()&lt;BR /&gt;  + " " + fileReference.getSequence(); &lt;BR /&gt;&lt;BR /&gt;  Runtime run = Runtime.getRuntime();&lt;BR /&gt;  Process pr;&lt;BR /&gt;  try {&lt;BR /&gt;   pr = run.exec(command);&lt;BR /&gt;   BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));&lt;BR /&gt;   String line = "";&lt;BR /&gt;   while ((line = buf.readLine()) != null) {&lt;BR /&gt;    result += line + "\n";&lt;BR /&gt;   }&lt;BR /&gt;  } catch (IOException e) {&lt;BR /&gt;   result = MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_VMS_ERROR;&lt;BR /&gt;   return (result);&lt;BR /&gt;  }&lt;BR /&gt;  return result;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;What is happenign is that in the findme.com file, the parameters are being assigned as follows : &lt;BR /&gt;&lt;BR /&gt;p1 = findme.com&lt;BR /&gt;p2 = DUMMYEMAIL&lt;BR /&gt;p3 = fileReference.getFormattedDateString()&lt;BR /&gt;p4 = fileReference.getBatch()&lt;BR /&gt;[ignored] fileReference.getSequence(); &lt;BR /&gt;&lt;BR /&gt;So the parameters are all offset by one. &lt;BR /&gt;&lt;BR /&gt;I have tried setting the command variable as follows (using a String[]) but the result is exactly the same : &lt;BR /&gt;&lt;BR /&gt;String[] command = {MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST,&lt;BR /&gt;DUMMYEMAIL,&lt;BR /&gt;fileReference.getFormattedDateString(),&lt;BR /&gt;fileReference.getBatch(),&lt;BR /&gt;fileReference.getSequence()}; &lt;BR /&gt;&lt;BR /&gt;I can get around this using an intermediary wrapper file but perhaps I am causing the problem.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Wed, 09 Jun 2010 14:50:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645209#M40027</guid>
      <dc:creator>Jonathan O'Donovan</dc:creator>
      <dc:date>2010-06-09T14:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645210#M40028</link>
      <description>&lt;BR /&gt;This is not an area i know much about, but apparently you indeed want to use a write DCL which activates the real thing.&lt;BR /&gt;The wrapper would contain something like:&lt;BR /&gt;&lt;BR /&gt;$ 'p1' 'p2' 'p3' 'p4' ...&lt;BR /&gt;&lt;BR /&gt;Maybe alter findme.com to open with:&lt;BR /&gt;  $ write sys$output f$environment ("procedure")&lt;BR /&gt;&lt;BR /&gt;Check out: &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h18000.www1.hp.com/java/documentation/1.4.2/ovms/docs/user_guide.html#UsingtheRuntimeexeMethodonOpenVMSAlpha" target="_blank"&gt;http://h18000.www1.hp.com/java/documentation/1.4.2/ovms/docs/user_guide.html#UsingtheRuntimeexeMethodonOpenVMSAlpha&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1226409" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1226409&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also be aware of DCL$PATH 'helping you'.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Jun 2010 15:36:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645210#M40028</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-06-09T15:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645211#M40029</link>
      <description>It's a feature and it is documented. The intention is to mimic Unix script behavior, where the parameter $0 hold the script name.&lt;BR /&gt;&lt;BR /&gt;I don't think that there is a feature logical to disable this behavior. But checking the Java for VMS documentation is always a good thing.&lt;BR /&gt;&lt;BR /&gt;If you need the DCL behaviour, you need a wrapper (no, there is no DCL shift command to rename parameters). Another DCL command procedure seems good enough.</description>
      <pubDate>Wed, 09 Jun 2010 15:51:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645211#M40029</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2010-06-09T15:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645212#M40030</link>
      <description>Jonathan:&lt;BR /&gt;&lt;BR /&gt;I think this thread on comp.os.vms explains the situation best for you:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://groups.google.com/group/comp.os.vms/browse_thread/thread/2ddac093d4522755/fa48b1496a27623b?q=runtime.exec+env&amp;amp;_done=%2Fgroup%2Fcomp.os.vms%2Fsearch%3Fgroup%3Dcomp.os.vms%26q%3Druntime.exec+env%26qt_g%3D1%26&amp;amp;_doneTitle=Back+to+Search&amp;amp;&amp;amp;d#fa48b1496a2762" target="_blank"&gt;http://groups.google.com/group/comp.os.vms/browse_thread/thread/2ddac093d4522755/fa48b1496a27623b?q=runtime.exec+env&amp;amp;_done=%2Fgroup%2Fcomp.os.vms%2Fsearch%3Fgroup%3Dcomp.os.vms%26q%3Druntime.exec+env%26qt_g%3D1%26&amp;amp;_doneTitle=Back+to+Search&amp;amp;&amp;amp;d#fa48b1496a2762&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Basically runtime.exec calls the CRTL routine execve and follows those rules.&lt;BR /&gt;&lt;BR /&gt;What you are seeing is expected behavior according to the thread.&lt;BR /&gt;&lt;BR /&gt;Bill.</description>
      <pubDate>Wed, 09 Jun 2010 16:04:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645212#M40030</guid>
      <dc:creator>Bill Pedersen</dc:creator>
      <dc:date>2010-06-09T16:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645213#M40031</link>
      <description>Passing the DCL command file name to P1 is a Java feature:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/83final/5763/5763profile_014.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/83final/5763/5763profile_014.html&lt;/A&gt;&lt;BR /&gt;...&lt;BR /&gt;For a DCL command procedure, the exec  functions pass the first eight arg0, arg1, ..., arguments specified in the exec  call to the command procedure as P1, P2, ... parameters, preserving the case.</description>
      <pubDate>Wed, 09 Jun 2010 16:33:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645213#M40031</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2010-06-09T16:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645214#M40032</link>
      <description>&lt;!--!*#--&gt;As I recall, we solved a problem like this by execing sys$system:loginout.exe and passing the command procedure name, etc. as parameters.&lt;BR /&gt;&lt;BR /&gt;I don't have the details close at hand as I've been retired a while, but if you can't take it from here let me know and I'll look through my source archive.&lt;BR /&gt;&lt;BR /&gt;What running it via loginout does for you is to allow your command procedure to be in the same DCL environment as you are when you login.&lt;BR /&gt;&lt;BR /&gt;Good luck with this!</description>
      <pubDate>Thu, 10 Jun 2010 02:13:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645214#M40032</guid>
      <dc:creator>Stuart Johnson_3</dc:creator>
      <dc:date>2010-06-10T02:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645215#M40033</link>
      <description>Thanks to all for the great help offered - I am really impressed by this forum! As suggested, I have used a wrapper .com file as follows to solve the problem : &lt;BR /&gt;&lt;BR /&gt;java_dcl_wrapper.com : &lt;BR /&gt;&lt;BR /&gt;$ @'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'&lt;BR /&gt;&lt;BR /&gt;I have used up to 8 parameters just so that I can reuse this wrapper for any .com file that needs to be invoked from Runtime.exec().&lt;BR /&gt;&lt;BR /&gt;Now my FileReleaseVmsImpl class looks as follows : &lt;BR /&gt;&lt;BR /&gt;package ie.interfusion.portal.business.remote.filerelease;&lt;BR /&gt;&lt;BR /&gt;import ie.interfusion.portal.business.MHConstants;&lt;BR /&gt;&lt;BR /&gt;import java.io.BufferedReader;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import java.io.InputStreamReader;&lt;BR /&gt;&lt;BR /&gt;import org.apache.log4j.Logger;&lt;BR /&gt;&lt;BR /&gt;public class FileReleaseVmsImpl implements FileReleaseIntf{&lt;BR /&gt; static Logger log = Logger.getLogger("ie.interfusion.portal.rmi.RmiFileRelease");&lt;BR /&gt; private String DUMMYEMAIL = "\"Test@test.com\"";&lt;BR /&gt; public String searchForFiles(FileReferenceVmsImpl fileReference) {&lt;BR /&gt;  String result = "";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  String[] command = {&lt;BR /&gt;    MHConstants.JAVA_DCL_WRAPPER,    &lt;BR /&gt;    MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST, &lt;BR /&gt;    DUMMYEMAIL,&lt;BR /&gt;    fileReference.getFormattedDateString(),&lt;BR /&gt;    fileReference.getBatch(),&lt;BR /&gt;    fileReference.getSequence()&lt;BR /&gt;   }; &lt;BR /&gt;&lt;BR /&gt;  log.info("Searching for file: " + fileReference);&lt;BR /&gt;  Runtime run = Runtime.getRuntime();&lt;BR /&gt;  Process pr;&lt;BR /&gt;  try {&lt;BR /&gt;   pr = run.exec(command);&lt;BR /&gt;   BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));&lt;BR /&gt;   String line = "";&lt;BR /&gt;   while ((line = buf.readLine()) != null) {&lt;BR /&gt;    result += line + "\n";&lt;BR /&gt;   }&lt;BR /&gt;  } catch (IOException e) {&lt;BR /&gt;   result = MHConstants.FILE_RELEASE_SEARCH_FOR_FILES_VMS_ERROR;&lt;BR /&gt;   log.error(e.getMessage());&lt;BR /&gt;   return (result);&lt;BR /&gt;  }&lt;BR /&gt;  return result;&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;The values of the MHConstants strings are as follows : &lt;BR /&gt;&lt;BR /&gt;public static final String JAVA_DCL_WRAPPER = "XXX:[java]java_dcl_wrapper.com";&lt;BR /&gt;public static final String FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST = "XXX:[JAVA]findme2.com";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that it seems that you have to put the '@' in the wrapper .com file - I get a &lt;BR /&gt;&lt;BR /&gt;%DCL-W-NOCOMD, no command on line - reenter with alphabetic first character &lt;BR /&gt;&lt;BR /&gt;error returned if I omit the '@' from the wrapper and instead put it in the FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST string as follows : &lt;BR /&gt;&lt;BR /&gt;public static final String FILE_RELEASE_SEARCH_FOR_FILES_COM_FILE_TEST = "@XXX:[JAVA]findme2.com";&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Jun 2010 09:49:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645215#M40033</guid>
      <dc:creator>Jonathan O'Donovan</dc:creator>
      <dc:date>2010-06-10T09:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: .com file invoked from java.lang.Runtime.exec() not same as when .com file invoked from dcl</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645216#M40034</link>
      <description>As already said in another thread, Java can run executable files. On VMS these are (main) images and command procedures. The "@XXX:[JAVA]findme2.com" does not specify a command procedure, it is a DCL command to invoke a comand procedure. Java should return a "java.io.IOException: Child creation error: no such file or directory".&lt;BR /&gt;&lt;BR /&gt;In the wrapper, you want to invoke the target command procedure, so you usually need the @. However, if a logical DCL$PATH is defined in the context of the Java subprocess running the wrapper, you do not need the @ sign to invoke the target command procedure. In your case the DCL$PATH should include the directory XXX:[JAVA].</description>
      <pubDate>Thu, 10 Jun 2010 12:26:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/com-file-invoked-from-java-lang-runtime-exec-not-same-as-when/m-p/4645216#M40034</guid>
      <dc:creator>H.Becker</dc:creator>
      <dc:date>2010-06-10T12:26:52Z</dc:date>
    </item>
  </channel>
</rss>

