dbTalk Databases Forums  

Re: Problems Execute Process Task and ist Return Code

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: Problems Execute Process Task and ist Return Code in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Darren Green
 
Posts: n/a

Default Re: Problems Execute Process Task and ist Return Code - 09-02-2004 , 11:06 AM






I am confused by your description, What is the run.cmd?

If I use a simple .Net console application exe, and "return" a value from
it, when run from the exec process task it will fail or succeed as expected
when the return set in the program value does not match the "Return code"
set in the task. If the return value does not match the task configured
return code, then the task is failed, and the on failure workflow is
followed as expected.

Just for info here is my simple test app-

using System;

namespace ConsoleReturn
{
/// <summary>
/// Summary description for ConsoleReturn.
/// </summary>
class ConsoleReturn
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static int Main(string[] args)
{
int ret = 0;

Console.WriteLine("ConsoleReturn.exe <return value>");

try
{
ret = Convert.ToInt32(args[0]);
Console.WriteLine("Return value " + ret.ToString() + " will be
returned.");
}
catch
{
ret = 0;
Console.WriteLine("No return value supplied. A default of 0 will be
used.");
}

return ret;
}
}
}


--
Darren Green
http://www.sqldts.com



"stoffi" <stoffi (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have a DTS with a Execute Process Task where i call a run.cmd. The
run.cmd
itself call a .net console application that on error returns a exitcode =
1.
In the cmd if i make echo %errorlevel% it returns me 1. till now all is
fine.
In DTS i have set the returncode off the execute process task as 0.
Why it doesn't raises the onfailure workflow?!?!?
what does i make wrong?!?!?
please help me
thx



Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Problems Execute Process Task and ist Return Code - 09-06-2004 , 11:10 AM






To be honest I don't understand your batch file, but a simple test shows
that I can wrap my EXE inside a batch file and the Exec Process Task works
as expected.

Try breaking the process down and testing each step in isolation to see what
may hide the error.


--
Darren Green
http://www.sqldts.com


"stoffi" <stoffi (AT) discussions (DOT) microsoft.com> wrote

Quote:
hmm this isn't the solution because e call a run.cmd that make this
@echo off
pushd c:\temp\

echo get current date's string ...
rem s00004: for /f "tokens=2,3,4 delims=/-. " %%i in ('date /t') do set
datestring=%%k%%i%%j
for /f "tokens=1,2,3 delims=/-. " %%i in ('date /t') do set
datestring=%%k%%i%%j

echo search for unused file-name ...
for /l %%i in (999, -1, 1) do if not exist %datestring%.%%i.* set
filename=%datestring%.%%i

echo starting exe

\\dev0\d$\prov_applications\Popcorn\ImportContract s\it.bz.prov.Popcorn.PF.Im
port.exe %1 %2 %3 %4 %5 %6 %7 >%filename%.log 2>%filename%.err
Quote:
echo Error: %errorlevel%
set myErrorLevel = %errorlevel%

errorlevel = %errorlevel%
echo cleaning up...
set datestring=
set filename=
set myErrorLevel=

popd

the it.bz.prov.Popcorn.PF.Import.exe is a .net console programm that
makes
on error this
System.Environment.ExitCode = 1;

but the execute process task don't know that the .net application has
failed. How can i passed this information?
thx


"Darren Green" wrote:

I am confused by your description, What is the run.cmd?

If I use a simple .Net console application exe, and "return" a value
from
it, when run from the exec process task it will fail or succeed as
expected
when the return set in the program value does not match the "Return
code"
set in the task. If the return value does not match the task configured
return code, then the task is failed, and the on failure workflow is
followed as expected.

Just for info here is my simple test app-

using System;

namespace ConsoleReturn
{
/// <summary
/// Summary description for ConsoleReturn.
/// </summary
class ConsoleReturn
{
/// <summary
/// The main entry point for the application.
/// </summary
[STAThread]
static int Main(string[] args)
{
int ret = 0;

Console.WriteLine("ConsoleReturn.exe <return value>");

try
{
ret = Convert.ToInt32(args[0]);
Console.WriteLine("Return value " + ret.ToString() + " will be
returned.");
}
catch
{
ret = 0;
Console.WriteLine("No return value supplied. A default of 0 will be
used.");
}

return ret;
}
}
}


--
Darren Green
http://www.sqldts.com



"stoffi" <stoffi (AT) discussions (DOT) microsoft.com> wrote in message
news:41D31884-050A-44C6-BE0A-93E62611AB1E (AT) microsoft (DOT) com...
I have a DTS with a Execute Process Task where i call a run.cmd. The
run.cmd
itself call a .net console application that on error returns a
exitcode =
1.
In the cmd if i make echo %errorlevel% it returns me 1. till now all
is
fine.
In DTS i have set the returncode off the execute process task as 0.
Why it doesn't raises the onfailure workflow?!?!?
what does i make wrong?!?!?
please help me
thx






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.