Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fortran compiler error!

Status
Not open for further replies.

lawochekel

Instructor
Dec 13, 2011
1
hi all, i tried to run a fortran program and i got this error message below;

C:\g77>g77 program001..f
program001..f:1:
PROGRAM 001
^
Invalid first character at (^) [info -f g77 M LEX]
program001..f:5:
IMPLICIT NONE
^
Invalid first character at (^) [info -f g77 M LEX]
program001..f:8:
PRINT *,' Type in your first name.'
^
Non-numeric character at (^) in label field [info -f g77 M LEX]
program001..f:9:
PRINT *,' up to 20 characters'
^
Non-numeric character at (^) in label field [info -f g77 M LEX]
program001..f:10:
READ *, First_Name
^
Non-numeric character at (^) in label field [info -f g77 M LEX]
program001..f:11:
PRINT *, First_Name
^
Non-numeric character at (^) in label field [info -f g77 M LEX]
program001..f:14:
END PROGRAM 001
^
Invalid first character at (^) [info -f g77 M LEX]

pls what am i suppose to do?

thanks
 
Take care : you are using g77 which is obsolete. g77 is a Fortran-77 compiler. So you must respect the Fortran-77 norm.

In particular :
- a normal instruction starts with 6 spaces
- a label (composed of digits) may occupy the columns 1-5
- the column 6 is reserved to indicate a continuation card
- an instruction cannot exceed 72 characters

In addition, your first instruction is invalid even with a more recent compiler (usually Fortran95 compliant) :
The keyword PROGRAM must be followed by a name. In Fortran, a name starts by a letter and is composed of letters and digits

The last instruction "END PROGRAM" is also incorrect in Fortran-77 (a simple "END" is required).

François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top