Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ames!skipper!altair!maine From: maine@altair.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.fortran Subject: Re: integer variable format address Message-ID: Date: 7 Mar 91 01:00:41 GMT References: <6769@idunno.Princeton.EDU> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 49 In-reply-to: moshkovi@sanandreas.ecn.purdue.edu's message of 6 Mar 91 21:08:36 GMT On 6 Mar 91 21:08:36 GMT, moshkovi@sanandreas.ecn.purdue.edu (Gennady Moshkovich) said: Gennady> userDHAL@mts.ucs.UAlberta.CA (David Halliwell) writes: >In article <6769@idunno.Princeton.EDU>, hsbrown@lemmy.Princeton.EDU (Scott Brown) writes: >>What is wrong with the following program? >> program test >> integer k >> k=1 >> write(*,k) >> >> 1 format('here is line 1') >> end >> > Try: > ASSIGN 1 TO K > instead of > K=1 > Gennady> This will not work on UNIX or DOS. Gennady> Instead do it with parameter statements Gennady> parameter(k=1) Gennady> ....... Gennady> I checked, it works. The ASSIGN had *better* work with the assign, as that is perfectly standard F77 (except for the lower case and possibly the lack of a carriage control character in the format, niether point was at issue here). On the other hand, the use of the parameter statement for this purpose is non-standard. I just checked on my Sun3 with SunOS 4.1.1 and fortran 1.3.1. The form with assign worked fine, as expected. I didn't bother to test the non-standard form using parameter, as I didn't care. Now I'd agree that usage of assign is "poor" style. I never once have used assign in my f77 code. As pointed out by other posters, the preferred way of handling such issues in f77 involves character variables as formats. However, poor style or not, the assign is standard, should work on any standard-conforming compiler, and does on at least the Sun compiler I just checked. -- -- Richard Maine maine@altair.dfrf.nasa.gov