Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RETRY in TRY-CATCH
Message
De
24/02/2008 16:53:43
 
 
À
22/02/2008 16:59:46
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:
01295955
Vues:
14
>I'm searching for information on how to simulate a RETRY from within a TRY-CATCH block. In this made-up scenerio I want to do some processing. This includes opening a file. If I can't open the file I will process using an alternative file. Something like
>TRY
>   some code
>   lcFile = MyGetFileRoutine()
>   USE (lcFile)
>   more code
>CATCH
>   IF "can't open file"
>     lcFile = MyGetAlternateFileRoutine()
>     RETRY
>   ELSE
>     do the normal CATCH programming
>   ENDIF
>ENDTRY
>
>I know this is illegal since you can't use RETRY within a TRY-CATCH. So I tried
>
>TRY
> some code
> lcFile = MyGetFileRoutine()
> ON ERROR DO ResetFile
> USE (lcFile)
> ON ERROR
> more code
>CATCH
> do the normal CATCH programming
>ENDTRY
>
>PROC ResetFile
> lcFile = MyGetAlternateFileRoutine()
> RETRY
>
>
>But the ON ERROR does not fire.
>
>
>I know I can re-code this particular example but.......
>
>Is there any way to incorporate RETRY capability into a TRY-CATCH????
>
>Thanks to all...........Rich
some code
TRY
   lcFile = MyGetFileRoutine()
CATCH WHEN "can't open file"
   lcFile = MyGetAlternateFileRoutine()
CATCH
     do the normal CATCH programming
ENDTRY
USE (lcFile)
more code
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform