I am porting Fortran 77 to Fortran 90. I am getting the following syntax error:
source.i(4): error #5082: Syntax error, found END-OF-FILE when expecting one of: <LABEL> <END-OF-STATEMENT> ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
compilation aborted for source.i (code 1)
make: *** [contempt28] Error 1
Here is the code in the source.i file:
There are only four lines to the source.i file.
The rest of the code that pertains to the source.i is in the source.f file shown here:
I followed the advice of this website with no luck
Here is the new source.i file based on what I read in the link above.
I am still getting the syntax error.
I modified the rest of the source code per the information I read in the link:
Thank you in advance for your time!
In general COMMAND_ARGUMENT_COUNT() replaces iargc(), GET_COMMAND_ARGUMENT replaces getarg and len_trim replaces lnblnk in newer Fortran.
It's hard to reproduce you error. Please supply a minimum working example, that others can compile.
I made some guesses and a working example could look like this (not elegant):
program test implicit none TYPE arg_struct integer :: length character(len=256) :: arg END TYPE integer :: i, uio integer :: arg_scratch, scratch_length integer, parameter :: arg_count=10, arg_steam=1 type(arg_struct), allocatable :: args(:) character(len=256) :: scratch !I am still getting the syntax error. !I modified the rest of the source code per the information I read in the link: if (COMMAND_ARGUMENT_COUNT() .ne. arg_count) then print *,'usage: contempt28_tu steamtable HPGLfile PGD RXI' & //' RXO HXO HXI axisfile scratchdir' call exit (1) end if ! ! Get the arguments from the command line. ! Note that the use of the argument array is parameterized for ! easy changes, if not easy reading. ! allocate(args(arg_count)) do i=1,arg_count call GET_COMMAND_ARGUMENT (number=i, value=args(i)%arg) args(i)%length = len_trim(args(i)%arg) end do arg_scratch = arg_count scratch = args(arg_scratch)%arg scratch_length = args(arg_scratch)%length ! ! Open the files. If there's trouble, let the f77 run-time library report ! the error. ! ! Open the steam table file (Use the logical name). This was ! jmj ! added to allow multiple executions. ! jmj ! jmj OPEN ( NEWUNIT = uio, FILE =args(arg_steam)%arg(:args(arg_steam)%length),& STATUS = 'OLD', READONLY, FORM = 'UNFORMATTED') ! jmj end program
If source.i contains only the four lines shown, then it cannot be compiled on its own.
I expect that originally it was 'included' into source.f, either with the standard Fortran statement
or using non-standard, C-like preprocessing as:
The "contempt28.i (named as source.i in the example) is an include file that is used by contempt28.f. The program is a beast, as it uses over 100 other souce codes and additional library files. I believe someone back in the 90s made a change to this code while it was using the f77 compiler. I'm running into problem porting this to intel fortran 90
Sorry I was not very clear presenting the problem. The include file just has those four lines. I was surprised when I saw this as well.
To Lorri and Johannes,
I am going to remove the contempt28.i code into the contempt28.f source and see if that works. Johannes, thank you so much for putting the code example together. I think that will be very helpful. I'll check back with you after I get the code updated.
The statement include 'contempt28_tu.i' is used in the contempt28.f code. I am linking the code on the build. Having just SAID that, something clicked. I would never link an include file on a build, why am I linking this one??? I am converting all f77 makefiles, code, etc... over to f90. and I wrote contempt28_tu.i as a link to the .f file. It just didn't click till now that it was originally done in error. I think I need to stop rethink what I'm doing. Thanks Lorri.