9 Replies Latest reply on Jan 20, 2010 8:57 PM by 697768

    OS Command Failed?

    697768
      I'm trying to run an OS command on Windows Server 2003 from a package (ODI version 10.1.3.4.0) using the following code CMD /c batch_name.bat but I'm getting an error message: Wrong process return code

      I created this file (batch_name.bat) into ODI bin directory. It's weird because the batch runs but the Operator shows that it failed. Why?


      Thank you
        • 1. Re: OS Command Failed?
          Bouch
          Try with OdiOscommand
          • 2. Re: OS Command Failed?
            JohnGoodwin
            Have you tried putting in the full path to the batch file e.g. CMD /c C:\temp\batch_name.bat

            Cheers

            John
            http://john-goodwin.blogspot.com/
            1 person found this helpful
            • 3. Re: OS Command Failed?
              697768
              ODIOSCommand is returning a similar error code: com.sunopsis.dwg.function.SnpsFunctionBaseException: OS command returned 1. at com.sunopsis.dwg.tools.OSCommand.actionExecute(OSCommand.java) at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java) at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java)



              Also, full path in OSCommand tool didn't make a change. Same error: Wrong process return code

              Error occurs under local agent and custom agent too and runs fine from CMD prompt.



              As a workaround I can create a procedure and ignore the error on this step. I'm wondering if there is another way to avoid that error.
              • 4. Re: OS Command Failed?
                JohnGoodwin
                out of interest what OS are you running it on?

                Cheers

                John
                http://john-goodwin.blogspot.com/
                • 5. Re: OS Command Failed?
                  697768
                  I specified in my first post: Windows Server 2003 (R2 Enterprise Edition SP2).
                  • 6. Re: OS Command Failed?
                    667719
                    Hey, how about putting a EXIT or EXIT 0 or EXIT /B 0 at the end of the batch file? Do you already have that? I can remember that CMD would not close unless I specify EXIT command under Win 2K. See if that works.
                    • 7. Re: OS Command Failed?
                      JohnGoodwin
                      Sorry I must pay more attention :)

                      Cheers

                      John
                      http://john-goodwin.blogspot.com/
                      • 8. Re: OS Command Failed?
                        JohnGoodwin
                        siddhartha@eastcoast wrote:
                        Hey, how about putting a EXIT or EXIT 0 or EXIT /B 0 at the end of the batch file? Do you already have that? I can remember that CMD would not close unless I specify EXIT command under Win 2K. See if that works.
                        I thought using the parameter /C makes sure it returns, e.g. CMD /C E:\script.bat
                        If you remove the /C then the execution never ends.

                        I can replicate "Wrong process return code" error message when the batch file cannot be found, though I am sure it returns that message for other reasons.

                        Cheers

                        John
                        http://john-goodwin.blogspot.com
                        1 person found this helpful
                        • 9. Re: OS Command Failed?
                          697768
                          It was tricky but now it's working. From ODI I have to call a batch script (Path1\B1) and from that batch script I have to call another one (Path2\B2)

                          In ODI I used cmd.exe /c Path1\B1.bat

                          In B1.bat:
                          CMD /C Path2\B2.bat
                          EXIT /B 0

                          in B2.bat:
                          commands.....