comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Catching I/O errors on RESTORE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Catching I/O errors on RESTORE [message #29671] Mon, 11 March 2002 21:03 Go to next message
alt is currently offline  alt
Messages: 28
Registered: August 2001
Junior Member
>
> I would very much like to hear reports on how well the CMSVLIB SAVE
> library does with corrupted files. It should report errors back to
> user programs without crashing.
>
It really does. Thanks. At least as far as I had opportunity to check.
I had problems with ordinary RESTORE and none of them is present now.
I am going to get huge statistics on CMSVLIB stability during my
software package running (save-restore every 10 sec through network)
this summer (forest fire season). Certainly I will inform you about
results.

Craig, it would be impudence to wish more but if your library had an
ability to replace (expand, squeeze, delete) variables in sav-files it
would be absolutely indispensable for organizing of IDL file container
and would be used very widely as I think. Just a wish, sorry :-))

Best regards,
Altyntsev Dmitriy
Remote Sensing Center, ISTP
Irkutsk, Russia
http://ckm.iszf.irk.ru
Re: Catching I/O errors on RESTORE [message #29684 is a reply to message #29671] Mon, 11 March 2002 06:08 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
alt@iszf.irk.ru (Altyntsev Dmitriy) writes:
> ... So I recommend to use CMSVLIB
> library of Craig B. Markwardt
> (http://cow.physics.wisc.edu/~craigm/idl/cmsave.html) which he kindly
> grants to IDL community.

I would very much like to hear reports on how well the CMSVLIB SAVE
library does with corrupted files. It should report errors back to
user programs without crashing.

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Catching I/O errors on RESTORE [message #29688 is a reply to message #29684] Sun, 10 March 2002 23:40 Go to previous messageGo to next message
R.Bauer is currently offline  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
============================================================ =======
Re: Catching I/O errors on RESTORE [message #29698 is a reply to message #29688] Sat, 09 March 2002 23:40 Go to previous messageGo to next message
alt is currently offline  alt
Messages: 28
Registered: August 2001
Junior Member
I have the similar problem while organizing simple IDL client-server
applications. Suppose client is trying to read sav-file before server
end up with writing...

Some possible useful ideas:
* CATCH (not ON_IOERROR) catches all errors including RESTORE errors
(unfortunately not all)
* FILE_TEST() checks file existence without opening it.
* file size can be obtained via (FSTAT(f)).SIZE
* FILE_INFO() (only in IDL 5.5) can get file size without opening it.
* sometimes (very rare) RESTORE can not restore all saved variables
and restore only part of them messaging "Truncating..." and CATCH does
not catch this situation (AFAIK). So I recommend to use CMSVLIB
library of Craig B. Markwardt
(http://cow.physics.wisc.edu/~craigm/idl/cmsave.html) which he kindly
grants to IDL community.

Best regards,
Altyntsev Dmitriy
Remote Sensing Center, ISTP
Irkutsk, Russia
http://ckm.iszf.irk.ru

MKatz843@onebox.com (M. Katz) wrote in message news:<4a097d6a.0203081046.1deaf7e@posting.google.com>...
> 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
Re: Catching I/O errors on RESTORE [message #29802 is a reply to message #29671] Tue, 12 March 2002 16:06 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
alt@iszf.irk.ru (Altyntsev Dmitriy) writes:

>>
>> I would very much like to hear reports on how well the CMSVLIB SAVE
>> library does with corrupted files. It should report errors back to
>> user programs without crashing.
>>
> It really does. Thanks. At least as far as I had opportunity to check.
> I had problems with ordinary RESTORE and none of them is present now.
> I am going to get huge statistics on CMSVLIB stability during my
> software package running (save-restore every 10 sec through network)
> this summer (forest fire season). Certainly I will inform you about
> results.

Thanks for the report!

> Craig, it would be impudence to wish more but if your library had an
> ability to replace (expand, squeeze, delete) variables in sav-files it
> would be absolutely indispensable for organizing of IDL file container
> and would be used very widely as I think. Just a wish, sorry :-))

You're right. It would be impudence.

Craig



[ Joking of course. ] Replacing, expanding, squeezing, deleting, are
all much harder operations than what CMSAVE can do right now. The
/APPEND option was "easy" in the sense that all you do is tack on some
more data at the end.

You might be amazed, at least I was, that IDL does not have a way to
trim an existing file. I'm talking about the same thing that
ftruncate() does in C. So "squeezing" would be very hard.

Probably then the easiest way to "replace" a variable is to restore
the file, replace the variable you want, then save it again. At least
at the moment.



--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Memory Problems
Next Topic: Visual C++ compiler option for >1GB of memory

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:48:41 PDT 2025

Total time taken to generate the page: 0.00563 seconds