- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to compile the fortran code andgetting the following error
fortcom; Error: file_name.f,line 659: too many continuation lines
compilation aborted
was trying to include raw data inside another file and incude that file using "include".
DATA FILE_SET ! file set is 15876 integer array
the file is too large and contains 4996 lines, I split the file into segments after each 615 lines. I wonder weather I can set the continuation line limit by any option. On g77, I was able to do that with -NC option. Please help
regards,
NT
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NT,
Try this:
Edit your input file to break it into lines of reasonable length (what you can read on the screen without line wraps).
For each line prepend (add to left side of line)
x('
and append(add to right side of line)
')
Representative line may look like the following
x(' 1234 5678 9012 ')
Next add to your application two subroutines that will populate the data array. One of the subroutines uses the FPP to define a subroutine call for "x" and #includes the text file in-line into the subroutine.
This makes a large subroutine that initializes your data. (Use FPP in your project for this file)
An alternate route would be to write the subroutines to open and read the text file.
But this will expose your data.
*** Note the following code is untested. Use it for reference
subroutine PopulateIntegerArray(Array)
integer :: Array(:)
integer :: LowerBound
integer :: UpperBound
integer :: i
LowerBound = LBOUND(Array)
UpperBound = UBOUND(Array)
Array = 0! Initialize to null
i = LowerBound
#define x(t) PopulateIntegerArrayStuff(Array,i,t)
#include 'YourDataFile.txt'
end subroutine PopulateIntegerArray
subroutine PopulateIntegerArrayStuff(Array,i,t)
integer :: Array(:)
integer :: i
character*(*) :: t
character(1000) :: InputLine
integer :: LowerBound
integer :: UpperBound
integer :: Delimiter
LowerBound = LBOUND(Array)
UpperBound = UBOUND(Array)
if(sizeof(t) .gt. sizeof(InputLine)) then
write(*,*) 'PopulateIntegerArrayStuff - (sizeof(t) .gt. sizeof(InputLine))'
write(*,*) 'Cell ', index
write(*,*) 'Data ', t
stop
endif
InputLine = t
do while(InputLine .ne. ' ')
InputLine = ADJUSTL(InputLine)
Delimiter = index(InputLine, ',')
if(Delimiter .ne. 0) then
InputLine(Delimiter:Delimiter) = ' '
cycle
endif
Delimiter = index(InputLine, CHAR(9))! TAB
if(Delimiter .ne. 0) then
InputLine(Delimiter:Delimiter) = ' '
cycle
endif
Delimiter = INDEX(InputLine, ' ')
if(i .gt. UpperBound) then
write(*,*) 'PopulateIntegerArrayStuff - (i .gt. UpperBound)'
stop
endif
read(InputLine(1:Delimiter-1),*) Array(i)
i = i + 1
InputLine(1:Delimiter-1) = ' '
end do
end subroutine PopulateIntegerArrayStuff
Jim Dempsey

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page