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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!kronos.arc.nasa.gov!iscnvx!jes
  3. From: jes@iscnvx.lmsc.lockheed.com (Jim Schafer)
  4. Subject: Runtime format statements 
  5. Message-ID: <1992Jul29.221739.29028@iscnvx.lmsc.lockheed.com>
  6. Organization: Lockheed Missiles and Space Co.
  7. Date: Wed, 29 Jul 92 22:17:39 GMT
  8. Lines: 54
  9.  
  10.  
  11.   I have a problem with 'runtime' FORMAT statements on the HP9000. 
  12.   Consider the routine PRNT:
  13.  
  14.        SUBROUTINE PRNT(ARAY,N,FORM)
  15.        CHARACTER*(*) FORM
  16.        WRITE(6,FORM) (ARAY(I),I=1,N)
  17.        RETURN
  18.        END
  19.  
  20.   According to the old Fortran 66 standards, the program
  21.  
  22.        dimension I(3),a(3)
  23.        data i/1,2,3/,A/4.,5.,6./
  24.        call PRNT(i,3,'(3i5)')
  25.        call PRNT(a,3,'(3f10.2)')
  26.        end
  27.  
  28.   should yield
  29.  
  30.     1    2    3
  31.       4.00      5.00      6.00
  32.  
  33.   (In Fortran 66, the type of value is assumed to match the format type,
  34.    no conversion is performed) 
  35.  
  36.   For many systems, this is the default ( convex, iris, mac(LS/MPW) )
  37.  
  38.   On other systems I get a 'Variable/Format type mismatch' error at
  39.   runtime (Vax,Cray,IBM-RS6000), indicating that the format type (3i5)
  40.   does not match the array type (ARAY). For these systems, I have been
  41.   able to turn off this type-checking. (The one exception has been the
  42.   latest DEC compiler on the Dec5000)
  43.  
  44.   On the HP9000, it doesn't complain but it yields:
  45.  
  46.     0    0    0
  47.       4.00      5.00      6.00
  48.  
  49.   It believed that the input arguments were floating point and saw that
  50.   I wanted an integer format, so it converted them to integer (yielding 0)
  51.   and then printed them. 
  52.  
  53.   I would like a way to turn off this type checking and force the HP
  54.   (and Dec5000) to trust the FORMAT and not do any conversion. 
  55.  
  56.   Any help would be appreciated. Thanks in advance,
  57.  
  58.  
  59.               Jim Schafer
  60.  
  61. -- 
  62. J.E.(Jim) Schafer
  63. jes@lmsc.lockheed.com
  64.