Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RETRY in TRY-CATCH
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01295546
Message ID:
01295620
Views:
13
O, I see what you mean:
llRetry = 0
lcFile  = MyGetFileRoutine()
DO WHILE llRetry < 3 && We don't want to loop endlessly here :-)
   TRY
         some code
         USE (lcFile)
  *      more code
         llRetry = 700
   CATCH WHEN 3 && Can not open the file
         lcFile = MyGetAlternateFileRoutine()
         llRetry = llRetry + 1
   CATCH
        *** do the normal CATCH programming
        llRetry = 700
   ENDTRY
ENDDO
>Borislav,
>
>The problem is that the assignment of lcFile = myGetAlternateFileRoutine() gets lost, so the code gets uglier.
>
>
>>Based on the first Hugo's answer:
>>
>>llRetry = .t.
>>DO WHILE llRetry
>>   llRetry = .f.
>>   TRY
>>      some code
>>      lcFile = MyGetFileRoutine()
>>      USE (lcFile)
>>*      more code
>>   CATCH WHEN 3 && Can not open the file
>>         lcFile = MyGetAlternateFileRoutine()
>>        llRetry = .t.
>>   CATCH
>>        *** do the normal CATCH programming
>>   ENDTRY
>>ENDDO
>>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform