Re: Catching I/O errors on RESTORE [message #29688 is a reply to message #29684] |
Sun, 10 March 2002 23:40   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
"M. Katz" wrote:
>
> Here's in I/O error-trapping question for the IDL gurus out there...
>
> Working in IDL 5.4 on SunOS UNIX, I'd like to catch errors
> that occur when reading a bad or incomplete--but existing--
> IDL SAVE file. I want to use ON_IOERROR, but it doesn't
> seem to catch errors that occur with the RESTORE function.
> Here's more information...
>
> I create a smallish (100-200 bytes) disk file with
>
> SAVE, x, y, z, filename="myfile.dat"
>
> Since I have lots of programs running simultaneously, different
> parts of my program or different IDL sessions may be
> SAVEing and RESTOREing these files in quick succession.
>
> Before I RESTORE, I always check for the existence of the file with
> FRELUN, 10
> OPENR, 10, filename, ERROR=err
>
> Sometimes, the file exists but is empty (!), then IDL tries to RESTORE
> and comes back with an END OF FILE error.
>
> SO, I put in an error catcher:
>
> ON_IOERROR, error_label
>
> Yet the program still halts with an END OF FILE, and the error
> trap is never activated. Any ideas?
> I would like the RESTORE file to trip the error trap and go
> nicely to my error-handling code.
>
> Thanks, MKatz
Dear MKatz,
I have had a similiar problem.
RESTORE,filename=file
PRINT,!error_state.name
IF !error_state.name NE 'IDL_M_SUCCESS' THEN MESSAGE,'FILE BAD',/INFO
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
============================================================ =======
|
|
|