home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!kronos.arc.nasa.gov!iscnvx!jes
- From: jes@iscnvx.lmsc.lockheed.com (Jim Schafer)
- Subject: Runtime format statements
- Message-ID: <1992Jul29.221739.29028@iscnvx.lmsc.lockheed.com>
- Organization: Lockheed Missiles and Space Co.
- Date: Wed, 29 Jul 92 22:17:39 GMT
- Lines: 54
-
-
- I have a problem with 'runtime' FORMAT statements on the HP9000.
- Consider the routine PRNT:
-
- SUBROUTINE PRNT(ARAY,N,FORM)
- CHARACTER*(*) FORM
- WRITE(6,FORM) (ARAY(I),I=1,N)
- RETURN
- END
-
- According to the old Fortran 66 standards, the program
-
- dimension I(3),a(3)
- data i/1,2,3/,A/4.,5.,6./
- call PRNT(i,3,'(3i5)')
- call PRNT(a,3,'(3f10.2)')
- end
-
- should yield
-
- 1 2 3
- 4.00 5.00 6.00
-
- (In Fortran 66, the type of value is assumed to match the format type,
- no conversion is performed)
-
- For many systems, this is the default ( convex, iris, mac(LS/MPW) )
-
- On other systems I get a 'Variable/Format type mismatch' error at
- runtime (Vax,Cray,IBM-RS6000), indicating that the format type (3i5)
- does not match the array type (ARAY). For these systems, I have been
- able to turn off this type-checking. (The one exception has been the
- latest DEC compiler on the Dec5000)
-
- On the HP9000, it doesn't complain but it yields:
-
- 0 0 0
- 4.00 5.00 6.00
-
- It believed that the input arguments were floating point and saw that
- I wanted an integer format, so it converted them to integer (yielding 0)
- and then printed them.
-
- I would like a way to turn off this type checking and force the HP
- (and Dec5000) to trust the FORMAT and not do any conversion.
-
- Any help would be appreciated. Thanks in advance,
-
-
- Jim Schafer
-
- --
- J.E.(Jim) Schafer
- jes@lmsc.lockheed.com
-