A couple of FORTRAN porting questions for g77

Janis Johnson janis187@us.ibm.com
Fri Jun 7 10:22:00 GMT 2002


On Fri, Jun 07, 2002 at 08:50:18AM -1300, Howard Chiger, hchiger@ttinet.com wrote:
> Hi.
> 
> Or maybe that should be Help!
[snip]
> 
> I have 3 basic problems.
> 
> 1) My codes do a lot of file I/O.  (They were written when 1 Mb of memory
> was huge, so they store a lot on disk).  They write files to disk using 
> external unit assignments. For example, on a VAX, I assign a unit number to a 
> file:
> 
> 	$ ASSIGN file_name FOR016
> 
> then, a FORTRAN WRITE(16,xxx) will write to the path defined as file_name.
> 
> On my Digital Unix (csh) port, the command would be 
> 
> 	setenv FORT16 file_name
> 
> But for the life of me, I can't find the assignment that works for g77.
> I have setenv'ed to fort16, fort016, fort.16, for16, for016, and also
> FORT16, FORT016, FORT.16, FOR16, FOR016.  All unsuccessfully.  I can
> only generate file output to fort.16.  Can you tell me the secret password????

There might be a better way, but you could have fort.16 be a symbolic
link to the file you want.

(You might also consider restructuring the program so it doesn't need
to do so much file I/O.)
> 
> 2) I use many PARAMETER statements and always use an IMPLICIT NONE, e.g.,
> 
> 	IMPLICIT NONE
> 	PARAMETER NDIM=100
> 
> g77 requires the PARAMETER be typed implicitly:
> 
> 	PARAMETER (NDIM=100)
> 
> and doesn't seem to allow it to be typed.  Thus I have had to remove the
> IMPLICIT NONE in each routine to get it to compile.  This is an acceptable
> workaround, especially since the codes are pretty static in their
> development.  But I feel naked without my IMPLICIT NONE statement.
> Is there a different workaround?

The right way to do this (not a workaround) is to declare the type of
each PARAMETER, just as you would for variables:

      IMPLICIT NONE
      INTEGER NDIM
      PARAMETER (NDIM=100)
      COMPLEX ZERO
      PARAMETER (ZERO=(0.0, 0.0))
> 
> 3) I also need to be able to feed the program input command line
> parameters.
[snip]

I don't know about this one.  Nothing you do here is likely to be
portable from one operating system to another.
> 
> Again, let me apologize for contacting you directly, but I can't think
> of anyone else at this point.  I would greatly appreciate any help
> you can give me.  And though I basically do all my work in C now,
> I still think of FORTRAN as my first language and don't want to see
> it relegated to relic or obsolete status.  If there is anything I
> can do to help you, be it code development or testing, please do not
> hesitate to ask me.

Find a Fortran 77 book; I did this recently and discovered that book
stores that sell new books don't seem to carry them, but my local used
techical book store had a good selection, although they were all rather
musty.
> 
> Thanks again,
> Howard Chiger
> San Diego, CA
> hchiger@ttinet.com

Janis (whose first language was Fortran)



More information about the Gcc mailing list