Fortran Commands (: C commands)
type name_list
REAL*4, REAL*8, REAL, COMPLEX*16, CHARACTER*n, LOGICAL
IMPLICIT type [implicit real*8 (a-h, o-z)]
PARAMETER (name=value) : #define name value
COMMON /name/ list
DIMENSION list
array(nd1,nd2,nd3,...) : a11,a21,a31,...,a12,a22,a32,...,a13,a23,a33,......
EQUIVALENCE (name1,name2,...)
EXTERNAL Routine_name
use name of subroutine or functionroutine itself as parameter
INTRINSIC
C or * at column 1 : /*.......*/
column 1 ; comment line if c or *
column 1 -- 5 ; label
column 6 ; continuation
column 7 -- 72 ; Fortran Statements
column 73 -- 80 ; comments
! ; start comments
DATA name /value/ or /(value1, value2, ...)/
Statement
Variable = Expression
(+, -), (*, /), **, (....)
GOTO
GO TO nn
GO TO (n1, n2, n3, ..., nk) intvl (positive)
nnn CONTINUE or Statement ; c1--c5, c7--c72
IF
IF(Conditional Expression) Statement
IF(Conditional Expression) THEN
Statements
ENDIF
IF(Conditional Expression) THEN
Statements1
ELSE
Statements2
ENDIF
IF(Expr1) THEN
.......
ELSE IF(Expr2) THEN
.......
ELSE
......
ENDIF
(.EQ., .LT., .GT., .GE.), .NOT., .AND., .OR. (.XOR., .EQV., .NEQV.)
IF(Expres) n1, n2, n3
DO ..... CONTINUE
DO nnn iv = istrt, iend, istep
..........
DO nnn jv = jstrt, jend, jstep
..........
nnn CONTINUE
Implied DO
PRINT *, (AA(i), i=istrt,iend,istep)
DO nnn WHILE(Expression)
.............
nnn END DO
READ (unit 5)
READ *, aa, ab(5), (ia(i),i=1,3)
READ fmtno, xx, xy
READ(unit, fmt, ERR=nerr, END=nend) x, y
WRITE (unit 6)
PRINT *, aa, ab(5), (ia(i),i=1,3)
PRINT fmtno, xx, yy
WRITE(unit, fmt, ERR=nerr, END=nend) x, y
FORMAT
fmtno FORMAT(fmt1, fmt2, fmt3, ......, fmtn) ; c1 -- c5, c7 -- c72
wX ; skip w blank spaces
Tn ; tap move to n-th column
wHstring ; character string of length w
[r]Aw ; r strings of width w
[r]Lw ; r Logicals of width w (true or false according to first character, t or f)
[r]Iw ; r integers of width w
[r]Fw.d ; r reals of width w and decimals d
[r]Ew.d ; r reals of width w and decimals d in form of xxx.ddd.Eee
[r]Dw.d ; r double precisions in xxx.dddDee
[r]Gw.d ; in form of either Fw.d or Ew.d depending on real
nPfedg
rZw ; r Hexadecimal number of width w
/ ; go to new line
'string' ;
r(fmt1, fmt2, ...) ; repeat (.....) r times
For output (iin first column of each line of output)
' ' ; new line
'0' ; skip a line
'1' ; new page
'+' ; same line
'-' ; skip two lines
STOP
STOP "Normal Termination"
END
SUBROUTINE
PROGRAM prognam
SUBROUTINE subnam(para1, para2, ....., paran)
type FUNCTION funcnam(para1, para2, ....., paran)
ENTRY
RETURN
END
fncname(dat1, dat2, ....., datn) = expression
CALL subnam(para1, para2, ....., paran)
xx = yy + funcnam(para1, para2, ....., paran)
Intrinsic Library Functions
SIN(x) ; x in radian
COS(x)
TAN(x)
ATAN(x)
EXP(x)
ABS(x)
SQRT(x)
ALOG10(x)
ALOG(x)
FLOAT(i)
IFIX(x)
MOD(i1,i2)
CMPLX(r1,r2)
REAL(cx)
IMAG(cx)
CONJG(cx)
RAN(ii)
File Usage
OPEN([unit=]nu [, FILE='filename', ERR=nn, IOSTAT=ios, STATUS='statu', RECL=lrecl, ACCESS='acces', FORM='formun' ])
statu ; OLD, NEW, SCRATCH, UNKNOWN
acces ; SEQUENTIAL, DIRECT
formun ; FORMATTED, UNFORMATTED
lrecl ; record length (in bytes)
CLOSE([unit=]nn [, ERR=nn, IOSTAT=ios])
stat ; KEEP, DELETE
REWIND([unit=]nn [, ERR=nn, IOSTAT=ios])
Compile and Link ; fort77 -o filexec filename.f -l library f77