How to Read the Syntax of FORTRAN

How to Read the Syntax of FORTRAN thumbnail
Fortran is a useful tool for scientists and engineers.

FORTRAN is a scientific applications programming language used by scientists and engineers. Developed in the mid- to late 1950s, it still has popular acclaim within these disciplines. FORTRAN is available for use on PCs, AIX and other Unix platforms, and on mainframe operating systems such as VM. FORTRAN is a highly portable language, and no matter if you use Fortran 77, Fortran 90 or another version, the syntax will be comparable. Check that your computer system and compiler are compatible and be aware of additional software requirements such as installations that may be needed for program calls. Fortran is precise and the compiler requires that programs are written using strict formatting guidelines.

Instructions

    • 1

      Get a printout of your Fortran program, or use an electronic editor to view it on your monitor screen.

    • 2

      Find the name of the program near the top. Look for the word "program" with the program name following. Program names start in column 1.

    • 3

      Examine programming statements for declarations. These come after the program name and are the constants and variables used in the program. Constants and variables can have arbitrary names. However, the type must be declared, such as integer, real, character and so forth. For example, r=real.

    • 4

      Read Fortran statements contained between columns 7 and 72. Statements can span several lines, and if they do, the letter "c," denoting continuation, will be in column 6 of each subsequent line.

    • 5

      Check out optional sequence numbers that may appear between columns 73 and 80. These columns are relics from the days when computer programs were compiled from 80-column punch cards. Numbers in these columns are unique and refer to the specific lines of code in the program.

    • 6

      Read expressions as you normally would read them. Know that mathematical expressions are written using operands, such as variables and constants, along with operators, such as the plus sign ("+") and other such appropriate mathematical symbols.

    • 7

      Search for logical expressions that denote relative quantity. Look for letters surrounded by dots, within logical expressions. Know that .LT. means less than, .GE. means greater than, .EQ. means equal and .NE. means not equal.

    • 8

      Look for constructs that have grouped expressions, including "if," "elseif," "else" and "endif." Read all lines between the "if" and the "endif" as a set of instructions that includes the conditions for which the instructions will run.

    • 9

      Treat statements between "do" and "enddo" as sets of instructions that are to be met until or while a condition is met.

    • 10

      Interpret "Read" and "Write" statements to mean input and output, respectively. Parenthetical data formats or raw data follow these statements.

    • 11

      Study the types of data formats available in Fortran. Each format code begins with a letter that tells the type of character that follows. For instance, "A" designates a text string, "D" double-precision number, "E" real number using exponent notation, "F" real number using fixed point format and "I" integer.

Related Searches:

References

  • Photo Credit Jupiterimages/Photos.com/Getty Images

Comments

Related Ads

Featured