Skip Navigation Links 

U of A University Information Technology Services

Was this page helpful?
 [+]





...Or log into AskIT
and request help.

 

fb

FORTRAN

FORTRAN77 [f77], FORTRAN90 [f90], and FORTRAN95 [f95] are available on our comp.uark.edu server. FORTRAN77 is compliant with the ANSI-1978 and ISO-1980 standards for the language and FORTRAN90 and FORTRAN95 are compliant with ANSI X3.198-1992 standard and ISO/IEC 1539:1991. These offer many extensions including recursion, pointers, structures, do while loops, and extended precision for both real and complex variables. This page provides basic information which will get you started running FORTRAN. It is assumed that you are already familiar with the FORTRAN language. The material here is adapted from various Sun Microsystems sources. For details and additional information, type:
man F77
or
man F90
at comp% prompt.

The following information is for FORTRAN77:

The f77 command is used to compile and link a FORTRAN source program to form an executable file. In the simplest case, you type:

    f77 progname.f

to produce an executable file and then type:

    a.out

to run the program. In this example, you replace "progname" with whatever word you are using for your own program source. The .f suffix (f77 also accepts .for) and the a.out are typed as shown. Also note the Solaris operating system is case sensitive and normally expects lower case user input.

If your program resides in several source files, just type the entry point file name first and follow with the other source file names, for example:

    f77 main.f sub1.f sub2.f

would compile the three source files in order to produce the executable a.out.

Since a.out is always the default executable name, one of the most common options for f77 is the -o option which allows you to set the executable name:

    f77 -o myprog mysource.f

In this example the "mysource.f" file is compiled into executable "myprog". Type

    myprog

to run the program.

Another popular option, especially for newly written source files, is the -c option which does only the compile step and does not produce an executable:

    f77 -c brandnew.f

The -C option (note the upper case) is also useful during program debugging work because it enables subscript checking in the executable. Finally, you can obtain a line numbered and cross referenced program listing with the -Xlist option:

    f77 -Xlist newsource.f

which will produce the file newsource.lst containing the listing. Naturally, multiple options (so long as they are compatible) may be declared:

    f77 -c -Xlist freshone.f

will compile only and produce freshone.lst.

 

 

Thank you for visiting UITS. This page can be found at:
http://uits.uark.edu/main/index_4206_ENG_HTML.htm