How do I fake an exit code of 0

  • I have DTS's that use activex scripts to succeed or fail in order to terminate the DTS without proceeding to the next step. It is so annoying that the job step reports failure because of this.

  • Instead of failing the step use activex to diable the steps you don't want to execute.

    Here is an example.

    sub chkfiles(flnm,tsk)

    set fso=createobject("scripting.filesystemobject")

    if fso.fileexists (flnm) then 

     DTSGlobalVariables.Parent.Steps("DTSStep_DTSDataPumpTask_"&tsk).DisableStep = False

     setprec "DTSStep_DTSExecuteSQLTask_2","DTSStep_DTSDataPumpTask_"&tsk

    else

     DTSGlobalVariables.Parent.Steps("DTSStep_DTSDataPumpTask_"&tsk).DisableStep = True

    end if

    end sub


  • Thank you for the quick reply, I was looking at that property and wasn't exactly sure how to use it. I am going to test this today. I want to see if the DTS will exit if the step(s) are reached but set "disabled."

  • They will.  I use this to import several files depending on whether they are there or not.  If you run it from in designer they will show as  steps thet were not run.  Remember to set the property either way so you are not depending on how it was last saved in the package.


  • what does this do?

    setprec "DTSStep_DTSExecuteSQLTask_2","DTSStep_DTSDataPumpTask_"&tsk

  • That is a sub I use to set step precedence so that future steps will run if I disable a middle step.  I have 50 files that come in and get processed but if only some come in I still want the processing to run after all of the available files have imported.  This sets a success precedent for each file that arrives so the processing waits for all of the imports to happen.  If you use this make sure you clear all of the precedence off of the step and then use this to set the ones you need.

    --remove precedence

    do While DTSGlobalVariables.Parent.Steps("DTSStep_DTSExecuteSQLTask_2").PrecedenceConstraints.count > 0

     DTSGlobalVariables.Parent.Steps("DTSStep_DTSExecuteSQLTask_2").PrecedenceConstraints.remove 1

    loop

    --set precedence

    sub setprec(dest,src)

    Set oPkg = DTSGlobalVariables.Parent

    Set Destination = oPkg.Steps (cstr(dest))

    Set Source = oPkg.Steps (cstr(src))

    Set Prec = Destination.PrecedenceConstraints.New(Source.name)

    Prec.PrecedenceBasis = DTSStepPrecedenceBasis_ExecResult

    Prec.value = DTSStepExecResult_Success

    Destination.PrecedenceConstraints.Add Prec

    Destination.DisableStep = False

    end sub


Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply