Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RETRY in TRY-CATCH
Message
De
22/02/2008 19:31:11
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01295546
Message ID:
01295624
Vues:
22
Hugo/Borislav

To me, the problem is more than that myGetFileRoutine might depend on "some code." It is that "some code" itself might not execute the same way the second time through. Assume that it's several lines long and a record pointer or variable value changes on line 8. Starting over on line 1 could lead to significantly different results.

>Borislav,
>
>Yes, I thought about doing like that, but then... I do not know if myGetFileRoutine depends on "some code", told you it gets ugly <g>
>
>>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
>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform