Re: Looping in MS SQL 2000 DTS

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



i think this behaviour and your code is correct, only the flag does not
change
if the falg does not change during execution, it returns an error
i the flag changes, it executes successfully

in this example the flag changes:

flag = 0
'Code to populat Flag with appropriate value

DTSGlobalVariables("counter").Value = _
DTSGlobalVariables("counter").Value + 1

Dim oPkg

If DTSGlobalVariables("counter").Value < 90 THEN
Set oPkg = DTSGlobalVariables.Parent

if DTSGlobalVariables("counter").Value = 56 then
flag = 1
end if
If Flag <> 1 Then
Main = DTSStepScriptResult_ExecuteTask

Else ' flag = 1
'Set oPkg = DTSGlobalVariables.Parent
'Set previous step status to waiting.
oPkg.Steps("DTSStep_DTSActiveScriptTask_1").ExecutionStatus = _
DTSStepExecStat_Waiting

'Do not execute task 2, step 1 will restart.
Main = DTSStepScriptResult_DontExecuteTask

End if

Else ' counter > 90

'Main = DTSTaskExecResult_Failure

End if

set oPkg = Nothing

End Function


'#####
' here the flag does not change, it retries 90 times, and then goes on to
the next task

flag = 0
'Code to populat Flag with appropriate value

DTSGlobalVariables("counter").Value = _
DTSGlobalVariables("counter").Value + 1

Dim oPkg

If DTSGlobalVariables("counter").Value < 90 THEN
Set oPkg = DTSGlobalVariables.Parent

If Flag <> 1 Then
Main = DTSStepScriptResult_ExecuteTask

Else ' flag = 1
'Set oPkg = DTSGlobalVariables.Parent
'Set previous step status to waiting.
oPkg.Steps("DTSStep_DTSActiveScriptTask_1").ExecutionStatus = _
DTSStepExecStat_Waiting

'Do not execute task 2, step 1 will restart.
Main = DTSStepScriptResult_DontExecuteTask

End if

Else ' counter > 90
Main = DTSStepScriptResult_ExecuteTask
'Main = DTSTaskExecResult_Failure

End if

set oPkg = Nothing

End Function


however, i do not really understand what you are trying to do. looping 90
times trough that should not really be a replacement for sleep.
if you want to make the system wait a few seconds, the easiest way is to
insert a SQL task inbetween the two activeX tasks you have and insert this
SQL statement:
WAITFOR DELAY '000:01:00'

each loop will then take one minute

perhaps you could describe in more detail what you are trying to do..
rgds
Leo

<GajanRaj@xxxxxxxxx> wrote in message
news:1120637010.607062.224090@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Any suggetions?
>


.



Relevant Pages

  • Looping in MS SQL 2000 DTS
    ... I am working on a DTS package which Checks a Flag and if required value ... Set oPkg = DTSGlobalVariables.Parent ... 'Do not execute task 2, ...
    (microsoft.public.sqlserver.dts)
  • Re: DO - WHILE loop in matlab?
    ... It has to do with end effects and termination tests. ... I know that I need to execute the body at least once, ... The while-do loop on the other hand, ... while flag ...
    (comp.soft-sys.matlab)
  • Re: which book to start with...?
    ... The CPU *would* execute it, ... find that Nasm puts its name in a .comment section...). ... but i dont understand how the previous test will set the sign flag. ... Not a bad idea - I find Nasm's version of the instruction set reference useful, even though it isn't up-to-date. ...
    (alt.lang.asm)
  • Re: Determining whether an applications has thrown some error ...
    ... set some flag and check the flag whether error is thrown or not ... ... It depends on where the error happens and what type it is versus where you want to execute the code. ... If the error is an exception (as your use of the word "thrown" implies) you can put the code in a catch block and it will execute "immediately" after the error is thrown (depending on the rest of the code). ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Question regarding UNIX access() call
    ... (Solaris, e.g., has eaccess() ... and a secret "E_OK" flag which you can or in to the access flags) ... you can execute a program before you actually executed it. ...
    (comp.unix.programmer)