home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / fortran / 2808 < prev    next >
Encoding:
Text File  |  1992-07-23  |  3.0 KB  |  97 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!noc.msc.net!uc.msc.edu!uh.msc.edu!doherty
  3. From: doherty@msc.edu (David C. Doherty)
  4. Subject: ERR= with free formatted READ on DECStation
  5. Message-ID: <1992Jul23.163959.10349@uc.msc.edu>
  6. Keywords: READ ERR DECStation f77
  7. Sender: doherty@uh.msc.edu (David C. Doherty)
  8. Reply-To: doherty@msc.edu
  9. Organization: Minnesota Supercomputer Center
  10. Date: Thu, 23 Jul 1992 16:39:59 GMT
  11. Lines: 84
  12.  
  13. I am having problems getting the ERR= statement to work
  14. with a List Directed READ, using f77 on a DECStation running
  15. Ultrix 4.1. The compiler identifies itself as DEC Fortran V3.0-2.
  16. When an error occurs, it seems not to branch to the ERR= label.
  17. If I change the READ to formatted, an error causes it to
  18. branch properly.
  19.  
  20. Is this a known problem or feature (like allowing character
  21. strings to be read into INTEGER variables)? I am relying on
  22. the ERR= to work properly in my code... so is there a way around this 
  23. (perhaps a compiler switch that I haven't found)?
  24.  
  25. in case my message is not clear, what follows are:
  26.  
  27. 1. the input file
  28. 2. snippet of code with free formatted READ
  29. 3. output of (2)
  30. 4. snippet of coded with FORMATTED READ
  31. 5. output of (4)
  32.  
  33. btw, the desired behavior is achieved with many other compilers (cf77 on
  34. CRAYs, f77 on IRIS (thought that this was the same mips compiler!)...)
  35.  
  36. any help would be greatly appreciated,
  37.  
  38. Dave Doherty
  39. Minnesota Supercomputer Center
  40. doherty@msc.edu
  41.  
  42.  
  43.  
  44. input file ('test.dat')
  45. ------------------------------------------------
  46.   1   1                 4.4000         1.5230         0.0000         0.0000 
  47.   1   5                 4.6000         1.1130         0.0000         0.0000 
  48. bend
  49.   1   1   5             0.3600       109.3900       109.4100       109.4100 
  50.   5   1   5             0.3200       109.4000       109.0000       109.0000 
  51.   1   1   1             0.4500       109.4700       109.5100       109.5100 
  52. ------------------------------------------------
  53. free-formatted READ code
  54. ------------------------------------------------
  55.       program test1
  56.       open(unit=13,file='test.dat',status='old')
  57.       do i=1,10
  58.         read(13,*,err=200)i,j
  59. 100     format(i3,x,i3)
  60.         write(6,100)i,j
  61.       enddo
  62.       goto 300
  63. 200   stop 'i/o'
  64. 300   continue
  65.       end
  66. ------------------------------------------------
  67. output of above code
  68. ------------------------------------------------
  69.   1   1
  70.   1   5
  71.   0   0
  72.   1   1
  73.   5   1
  74.   1   1
  75. i/o
  76. ------------------------------------------------
  77. formatted READ code
  78. ------------------------------------------------
  79.       program test2
  80.       open(unit=13,file='test.dat',status='old')
  81.       do i=1,10
  82.         read(13,100,err=200)i,j
  83. 100     format(i3,x,i3)
  84.         write(6,100)i,j
  85.       enddo
  86.       goto 300
  87. 200   stop 'i/o'
  88. 300   continue
  89.       end
  90. ------------------------------------------------
  91. output of above code
  92. ------------------------------------------------
  93.   1   1
  94.   1   5
  95. i/o
  96. ------------------------------------------------
  97.