Hi!
Then, if subroutines used, this approach might be even more better.
Take a look to the RETURN command help. As you see, you can return to any procedure from the procedures call stack missing the rest of all other procedures code that are called after the procedure where you returning to. For example:
A.pRG
....
DO B
B.PRG
....
DO C
C.PRG
....
DO D
D - return to B here
... - this code not running after return from D to B
.... the rest code of B
I guess you can use that way to return to special program that call the entire process from any subroutines.
PS: I understand that certainly the thread was about other things, however, I just tried to answer your particular question about returning from the any point of the long process. As you see, you can organize this without constant checking for some logical variable. Tough this violates the OOP and structured programming, so this should have limited use.
>Oops, re-send.
>
>Vlad,
>
>Not sure I understood you. If you suggest to touch oValid object methods, I can't do it, unfortunately, since it's not my object (it belongs to another application, which is my colleague's).
>
>My desire to stop do while loop without execution other code. BTW, this loop calls some other programs, which also have do while oValid.lContinue in them:
>
>e.g. (pseudo-code)
>
>lnI=0
>do while oValid.lContinue and Not end of first array (array of all DBCs)
> lnI=m.lnI+1
> .........
> Open DBC for possible changes
> lnK=0
> do while oValid.lContinue and lnK < Number of tables in DBC
> lnK=lnK+1
> ...
> Check open table, free disk space, etc.
> =Modify_structure
> =Modify_indexes
> enddo
>enddo
>
>Thanks in advance.
>
>>Hi!
>>
>>What about returning to the calleer program? In other words, you have following:
>>
>>
>>* Caller.PRG
>>...
>>DO MyLongProcess
>>...
>>
>>
>>
>>* MyLongProcess.PRG
>>do while oValid.lContinue
>> User pressed ESC here, so oValid.lContinue=.f.
>> lots of other code
>>enddo
>>
>>
>>
>>* SomeEvent.PRG
>>
>>
>>...
>>
>>return to &lcProcName
>>
>>
>>I guess this will stop the long process immediately, though you will require to do the cleanup in the caller PRG instead of at th end of MyLongProcess PRG.
>>
>>HTH.
>>
>>>do while oValid.lContinue
>>> User pressed ESC here, so oValid.lContinue=.f.
>>> lots of other code
>>>enddo
>>>
>>>I don't want to execute lots of other code, I want to stop loop immediatelly, after oValid.lContinue=.f.
>>>
>>>In other words, do while checks its condition only in the next pass, it doesn't check its condition inside the loop, which is my desire.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.