- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear everyone,
I programmed a module, ReadMe, to read the input data from txt files and save it in an array, qrrf. The input data is variable-size arrays for each time step. The errors and main code are shown below. Would you please me some advice on this problem? Thank you in advance for your time and help.
When I compile the code, it shows several errors as below:
Error Compilation Aborted (code 1) D:\...\ppane .for 1
Error error #6406: Conflicting attributes or multiple declaration of name. [READH1DIN] D:\...\ppane .for 719
Error error #6580: Name in only-list does not exist or is not accessible. [READH1DIN] D:\...\ppane .for 109
Error error #7002: Error in opening the compiled module file. Check INCLUDE paths. [ReadMe]
D:\...\ppane .for 109
- Line 109: USE ReadMe, ONLY: ReadH1DIN
- Line 719: qrrf = ReadH1DIN ('qrrf_dt', Nk)
The main code is shown below:
(1) subroutine
subroutine ppane (t, z, nd, sat)
USE ReadMe, ONLY: ReadH1DIN
DOUBLE PRECISION, ALLOCATABLE, SAVE :: qrrf(:,:)
...
qrrf = ReadH1DIN ('qrrf_dt', Nk)
...
END Subroutine
(2) function
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Start
C FUNCTION ReadH1DIN
MODULE ReadMe
CONTAINS
FUNCTION ReadH1DIN (NAMEIN,Nk)
IMPLICIT DOUBLE PRECISION (A-H, O-Z)
INTEGER InputH1D, IIND, Nk
CHARACTER(LEN=75) :: FILNAM
CHARACTER NAMEIN*(*)
DOUBLE PRECISION, ALLOCATABLE :: ReadH1DIN(:,:)
WRITE (FILNAM,1225) NAMEIN,'.txt' !Define the path and name of the input data text file
1225 FORMAT (A,A4)
OPEN (UNIT=101, FILE=FILNAM, STATUS='OLD')
READ(101,*) !Skip the header
InputH1D = 0
DO
READ(101,*,IOSTAT=IO) TRASH
IF (IO.NE.0) EXIT !Exit the loop when last line has been reached
InputH1D = InputH1D + 1 !Counts how many time periods inputs are set for the input data type
END DO
REWIND(101) !Rewind text file to read the inputs
ALLOCATE(ReadH1DIN(InputH1D,2*Nk)) !Allocate the input data array
READ(101,*) !Skip the header
DO 1226 IH1D=1,InputH1D
READ(101,*) (ReadH1DIN(IH1D,IIND), IIND=1, 2*Nk) !Save the data in the main array
1226 CONTINUE
RETURN
END FUNCTION
END MODULE ReadMe
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC End
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a icon you press that allows you to insert the code in Fortran format. I suggest you repost the code so it is easier to read. Provide a sample input and then it can be run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have followed your suggestion and add the whole “Module” code. Would you please go through it at your convenience?
Thank you very much for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is, I am certain, code you have not shown us that is relevant to this problem.
Why are you writing fixed-form source in 2022?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
I add the whole “Module” code. Would you please go through it at your convenience?
Thank you for your time and help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You still have not shown us enough. The source you did show compiles without error.
Please attach a ZIP of a minimal reproducible example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I removed the lines of code with "..." from what you posted, compiled the module source file and then the subroutine source file (you call this the "main code", but this is not the main program unless you are building a DLL). The compilation did not produce any warning or error messages; therefore, any errors that you encountered are attributable to lines of code that you did not show us yet. The subroutine code that you showed contains only five lines, whereas one of the error messages refers to line 719 and the other to 109.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Taking a flying leap ...
Perhaps have you made a module out of some old code?
If so, check to see if you forgot to remove:
EXTERNAL ReadH1DIN
From the code than now contains
USE ReadMe, ONLY: ReadH1DIN
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