home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / statl / 1179 < prev    next >
Encoding:
Text File  |  1992-07-21  |  3.9 KB  |  91 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!ERS.BITNET!ATKINSON
  3. Message-ID: <CMM.0.90.2.711665776.wgreene@option.stern.nyu.edu>
  4. Newsgroups: bit.listserv.stat-l
  5. Date:         Tue, 21 Jul 1992 07:22:35 EDT
  6. Sender:       "STATISTICAL CONSULTING" <STAT-L@MCGILL1.BITNET>
  7. Comments:     Resent-From: Linda Atkinson <ATKINSON@ERS>
  8. Comments:     Originally-From: William Greene <wgreene@option.stern.nyu.edu>
  9. From:         "Linda Atkinson" <ATKINSON@ERS.BITNET>
  10. Subject:      LIMDEP
  11. Lines: 78
  12.  
  13. This is a second message I received from Dr. Greene about LIMDEP, with
  14. more detailed information on work-arounds for the mainframe version.
  15.  
  16. +----------------------------------------------------------------------+
  17. | Linda Atkinson, Statistician     | BITNET:  ATKINSON@ERS             |
  18. | U.S. Department of Agriculture   | Tel:     (202) 219-0505           |
  19. | Economic Research Service        | FAX:     (202) 219-1292           |
  20. | Washington, D.C.                 |          (ATTN: RM 240)           |
  21. +----------------------------------------------------------------------+
  22.  
  23. ----------------------------Original message----------------------------
  24. Dear Linda:  (Listen closely and see if you can pick up my frustration.)
  25.  
  26.     The problem you are having with LIMDEP is now very familiar to me,
  27. and is arising from two sources:  (1) An incompatibility between IBM's Fortran
  28. and every other Fortran with which I am familiar, which, as you can
  29. imagine, is a lot and (2) A bug in the IBM fortran compiler which, as far
  30. as I know, has always been present, and shows no sign of being eradicated.
  31. For your programmer's benefit, the offending statement is
  32.  
  33.     READ(IUD,2421,END=993,ERR=992)(LINE(J),J=ONE,255)
  34.  
  35. which follows statement number 241 in subroutine LOAD.  This line is
  36. attempting to read a character string of indeterminate length, in
  37. individual bytes.  Since I do not know how long the line is to be, I just
  38. read a long line.  Here is what happens if the line has less than 255
  39. characters:
  40.  
  41.     IBM fortran (MVS, CMS, all of them): Program crashes, as you saw.
  42.     All other fortrans:  Unread characters are filled with blanks.
  43.  
  44. Now, notice that the statement contains an ERR=992.  This is designed to
  45. prevent programs which encounter data errors from crashing.  It is not
  46. working.  That is the bug.  There is no ambiguity about it as far as I can
  47. see.  The odd thing about this, once again, unique to IBM, is that this
  48. whole problem disappears a) if the 255 above is changed to an 80, whether
  49. or not the line read is actually 80 characters long or not and b) if
  50. the line really is 255 characters long, for obvious reasons.
  51.  
  52.     From your point of view, there are a couple of short term fixes
  53. you can use:
  54.     (1)  Use only formatted data sets, and include format statements
  55. in the READ statement.
  56.     (2)  The following block of code can replace its current
  57. counterpart in subroutine LOAD.  This reverts back to the 80 character
  58. limit of version 5.1, but apparently IBM fortran will not choke on it.
  59.  
  60.   240  IRD=ZERO
  61.   241  DO 242 J=ONE,80
  62.   242  LINE(J)=' '
  63.        READ(IUD,2421,END=993,ERR=992)(LINE(J),J=ONE,80)
  64.  2421  FORMAT(255A1)
  65.        IF(LINE(1).EQ.'.'.AND.LINE(2).EQ.' ')LINE(1)='*'
  66.        DO 2473 J=ONE,79
  67.  2473  IF(J.GT.ONE.AND.LINE(J).EQ.'.'.AND.LINE(J-ONE).EQ.' '.AND.
  68.      &    LINE(J+ONE).EQ.' ')LINE(J)='*'
  69.        DO 243 J=ONE,80
  70.        IF(LINE(81-J).EQ.' '.OR.LINE(81-J).EQ.',')GO TO 243
  71.        LINE(82-J)='$'
  72.        GO TO 244
  73.   243  CONTINUE
  74.        GO TO 241
  75.   244  IFR=ZERO
  76.        DO 245 J=ONE,80
  77.        IF(LINE(J).EQ.' ')LINE(J)=','
  78.   245  IF(LINE(J).NE.','.AND.IFR.EQ.ZERO)IFR=J
  79.  
  80. Once again, it is a mystery to me why IBM has locked itself into this 80
  81. character format, but apparently, it is the bottleneck.  Keep in mind,
  82. again, for unformatted data sets, you are limited to 80 character lines.
  83.  
  84.     It might be helpful if you could put this out on to the network,
  85. since I do not access it.
  86.  
  87.         Regards,
  88.         Bill Greene
  89.  
  90. 
  91.