Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RETRY in TRY-CATCH
Message
From
24/02/2008 16:53:43
 
 
To
22/02/2008 16:59:46
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01295546
Message ID:
01295955
Views:
12
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform