home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / fortran / 4832 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  1.2 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!mcsun!sunic!aun.uninett.no!nuug!statoil!petek.tek.st.statoil.no!c79057
  2. From: c79057@petek.tek.st.statoil.no (Joergen Leiknes)
  3. Newsgroups: comp.lang.fortran
  4. Subject: How to detect format overflow
  5. Message-ID: <1992Dec22.140111.5270@statoil.no>
  6. Date: 22 Dec 92 14:01:11 GMT
  7. Sender: usenet@statoil.no
  8. Reply-To: c79057@petek.tek.st.statoil.no (Joergen Leiknes)
  9. Organization: Statoil
  10. Lines: 32
  11. Nntp-Posting-Host: idunn.petek.tek.st.statoil.no
  12.  
  13. I want to detect overflow in format statements, to avoid to have
  14. asterisks in the produced output. (Yes,I know that it is possible
  15. to have larger fields for each variable, but it would be nice to
  16. have an error jump when such things occur)
  17.  
  18. In the little test program below:
  19.       PROGRAM IOTEST
  20.       INTEGER ISTAT, I
  21.       REAL X
  22.       X = 123123.3
  23.       I = -123123
  24.       WRITE(*,700,ERR=900, IOSTAT= ISTAT) X, I
  25. 700   FORMAT(' X is ',F6.3,' I is ',I6)
  26.       GOTO 999
  27.  
  28. 900   CONTINUE
  29.       WRITE(*,*) ' IOERROR no. ', ISTAT
  30.       GOTO 999
  31.  
  32. 999   CONTINUE
  33.       END
  34.  
  35. Gives this output:
  36.  X is ****** I is ******
  37.  
  38. and no error is catched.
  39.  
  40. I would like to know if it is possible according to f77 or f90 standard
  41. to catch such overflows.
  42.  
  43. Thanks in advance
  44. Jorgen Leiknes, Statoil NORWAY
  45.