1. Registered User
Join Date
Feb 2004
Posts
3

I am creating a fairly complex DTS package that uses some Perl scripts, and I'm running into a problem with the SuccessReturnCodes. Here's my problem:

On success of the Perl script, my package moves on to the next step 'On Success', no problem...

But on failure of the Perl script, execution of the Package simply stops, instead of going to the 'On Failure' step of my workflow.

I'm in testing of this package now, and I've repeatedly broken my Perl, both in the Perl script itself, and in the 'Execute Process Task' that calls the script, and I can't seem to get the Package to follow the 'On Failure' workflow path.

In my mind, it would be logical that anything other than the specified Return Code (0 [zero] in this case) would result in following the 'On Failure' workflow path, but this doesn't seem to be the case.

Any assistance on this would be greatly appreciated.

2. Registered User
Join Date
Dec 2002
Posts
1,245

## Re: DTS SuccessReturnCodes

First, I have never done a DTS with PERL, so I may be way off base here...

Second, How is PERL being invoked? are you executing the PERL from a Shell inside another script?

Check that you are setting the correct flag. There is one flag for the DTS package as a whole, and there is a separate one for the DTS Task step. The DTS Task step nomenclature (in VBScript) is simply:

Code:
 Main = DTSTaskExecResult_Failure
where Main is the name of the Function being executed.

There is another variable (can't remember it's name) for failing the overall package.

3. Registered User
Join Date
Feb 2004
Posts
3

## Re: DTS SuccessReturnCodes

Originally posted by hmscott
First, I have never done a DTS with PERL, so I may be way off base here...

Second, How is PERL being invoked? are you executing the PERL from a Shell inside another script?
I'm using Perl through the Execute Process Task, rather than through the ActiveX Script Task, as I want to keep my Perl in external files for easier management/portability (I just don't trust keeping code in an app that I can't edit in plaintext). I'm using Perl specifically because I desperately want to avoid learning VBScript., and I'm explicitly calling Active State's Perl b/c I know I can trust it to be more standard Perl than any Windows-bundled Perl.

I call it as follows:
Win32 process: d:\path\to\perl.exe (I'm using ActiveState's Perl here)
Parameters: d:\path\to\my\perlscript.pl "arg1" "arg2" "arg 3"
Return Code: 0
Timeout: 25

In my Perl script, I have clauses built in that will take the arguments above, and will (with specific args supplied) break execution, causing the Perl app to fail by design.

What I can't seem to find in the DTS itself is how to make it take the failure of the Perl app, and direct the workflow path down the 'On Failure' branch of the workflow. When it hits that point it stops execution of the package instead of traversing the failure path.

What this ends up meaning in practical terms is that I get an email if everything goes right, but I don't get one if something goes wrong.

I suppose I could conceivably set up a second DTS package to run on an independent schedule that emails the log I'm generating to me, but in the future I'd prefer to get an email only when things break.

4. Registered User
Join Date
Dec 2002
Posts
1,245

## Re: DTS SuccessReturnCodes

Okay, I'm not certain that I can be of much help here. I just did a quick test with the Execute Process Task in a DTS package. I set it up with two workflow branches, one on failure and one on success.

For the task itself, I used:
Win32 process: ping.exe
Parameters: [nothing]
Return Code: 0
Timeout: 0

I used nothing in the parameters to cause ping to deliberately fail. When I executed the package, it immediately routed to the failed workflow branch.

I would have to deduce from this that your PERL is somehow not returning a failure code or status upon unsuccessfully completing.

Beyond that, I really know nothing about PERL (though I wouldn't mind learning). VBScript really isn't too awful; it does require some effort to learn however, so I can understand where you are coming from.

Good luck,

hmscott

5. Registered User
Join Date
Feb 2004
Posts
3

## Re: DTS SuccessReturnCodes

Originally posted by hmscott
I would have to deduce from this that your PERL is somehow not returning a failure code or status upon unsuccessfully completing.
The most commonly returned code I have seen so far has been '22' (I don't know why 22 -- it's not from anything in my script)

Logic would dictate that if my specified Return Code was '0', that any non-zero result would mean that it would take the Fail path. Apparently that isn't the case.

Beyond that, I really know nothing about PERL (though I wouldn't mind learning). VBScript really isn't too awful; it does require some effort to learn however, so I can understand where you are coming from.
It's really not the effort that's the problem -- but I'm already a coder in several different languages (I just recently was told I had to pick up Perl), and I just needed to put my foot down somewhere. Enough languages, already.

Good luck,

hmscott
Thanks... I'll keep plugging at this.

--K

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•