Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28815 Discussions

error FOR2771: too few arguments in reference TO MODULE

uddin__md
Beginner
1,977 Views

I WRITE A PROGRAM FOR WATER QUALITY MODELLING. THIS PROGRAM CONTAINS WITH FIVE MODULE THIS THE FIRST ONE.  ONE IS FOR THE MEDIAN VALUE CALCULATE. WHEN I COMBINED ALL MODULES INTO MAIN PROGRAM, THE COMPILER GAVE AN ERROR MEAASSES AS "error FOR2771: too few arguments in reference  TO MODULE".  I AM NEW USER IN FORTRAN. I AM SHEEKING SUPPORT TO SOLVE THIS PROBLEM. MANY THANKS FOR YOUR SUPPORTS. @andrew_4619 

 

MODULE DATAMEDIAN
IMPLICIT NONE
REAL , DIMENSION (100):: X 
INTEGER, PRIVATE :: I,J,K,L,N
REAL :: TEMP,MEDIAN

CONTAINS

SUBROUTINE MEDIANVALUE (X,N)
IMPLICIT NONE
REAL , DIMENSION (100):: X 
INTEGER :: I,J,K,L,N
REAL :: TEMP,MEDIAN
OPEN(1, FILE = 'SALDATA07.DAT', STATUS='OLD')
OPEN(2, FILE = 'MEDIAN.DAT', STATUS='UNKNOWN')

READ (1,*) N
WRITE(*,*) 'NUMBERS OF INPUT DATA', N
READ(1,*) (X(I), I=1,N)
DO K=1, N-1
DO L=K+1,N
IF (X(K) .GT. X(L)) THEN
TEMP = X(K)
X(K) = X(L)
X(L) = TEMP
END IF 
1 CONTINUE
IF (MOD(N,2) .EQ. 0.0) THEN
MEDIAN=(X(N/2.0)+X((N/2.0)+1))/2.0
ELSE
MEDIAN=X((N+1)/2.0)
END IF
END DO
END DO
WRITE(2,10) NINT(MEDIAN)
10 FORMAT (10I10)
WRITE(*,*) 'MEDIAN IS', MEDIAN
CLOSE(1)
CLOSE(2)
RETURN
END SUBROUTINE

END MODULE

PROGRAM	MAIN
USE DATAMEDIAN
CALL MEDIANVALUE(X,N)

END PROGRAM

 

 

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
1,845 Views

I don't know your program. The call to MEDIANVALUE needs two arguments passed to it. But looking at the routine, it seems to want to do everything internally, so you could just delete "(X,N)" in the SUBROUTINE MEDIANVALUE line.

I can't say whether the rest of the calls after line 700 are correct, but at least they aren't invalid Fortran.

View solution in original post

0 Kudos
15 Replies
andrew_4619
Honored Contributor III
1,950 Views

I do not get that error with the code posted. What compiler version are you using?

1] always use implicit none ( it is not in your main program )

2] /warn:all and /stand are recommended (by me) for development codes.

I think that will help you a lot.

0 Kudos
uddin__md
Beginner
1,942 Views
@Andrew I used Microsoft Developer studio to compile the codes . When I run that module separately it was working fine. But when I run it into main program that module gave that error. Other module run without any errors. If you feel easy I send it whole program to your kind consideration at insight views.
Many thanks for your support.
0 Kudos
Steve_Lionel
Honored Contributor III
1,921 Views

That is not an Intel Fortran error message. Is that Microsoft Fortran PowerStation?

0 Kudos
uddin__md
Beginner
1,911 Views
@Steve_Lionel, that is correct. Exactly that was the Microsoft Fortran PowerStation.
0 Kudos
Steve_Lionel
Honored Contributor III
1,897 Views

That compiler is AT LEAST 23 years old and had many bugs. You seem to have found one. We can't help you with it - the code you have looks fine and would compile with a compiler from this century.

0 Kudos
uddin__md
Beginner
1,894 Views
@Steve_Lionel, many thanks for your feedback. Would you suggest me which compiler more suitable for me and also can I get it free of costs.
0 Kudos
Steve_Lionel
Honored Contributor III
1,888 Views

I would suggest gfortran. Note that we can't help you with installation or use of non-Intel compilers in this forum.

0 Kudos
JohnNichols
Valued Contributor III
1,883 Views

That compiler is AT LEAST 23 years old and had many bugs.

You mean very many -- as in a prime number not less than 12 digits. 

using the one before the Internet lead to thoughts of .......

0 Kudos
mecej4
Honored Contributor III
1,864 Views

Uddin_md:

The source file compiles and links fine when Powerstation 4 is used. You probably received the reported error message when working with some other code.

0 Kudos
uddin__md
Beginner
1,855 Views

Dear ( @Steve_Lionel @andrew_4619 , @mecej4 , @JohnNichols )All, Many thanks for your feed back. I placed my full program herein for your expertise knowledge to solve this issues. Again many thanks all.

MODULE DATAMED
IMPLICIT NONE
REAL , DIMENSION (100):: X 
INTEGER, PRIVATE :: I,J,K,L,N
REAL :: TEMP,MEDIAN

CONTAINS

SUBROUTINE MEDIANVALUE (X,N)
IMPLICIT NONE
REAL , DIMENSION (100):: X 
INTEGER :: I,J,K,L,N
REAL :: TEMP,MEDIAN
OPEN(1, FILE = 'SALDATA07.DAT', STATUS='OLD')
OPEN(2, FILE = 'MEDIAN.DAT', STATUS='UNKNOWN')
!DATA COUNT AND READ FROM INPUT FILE 
READ (1,*) N
WRITE(*,*) 'NUMBERS OF INPUT DATA', N
READ(1,*) (X(I), I=1,N)
DO K=1, N-1
DO L=K+1,N
!DATA SWAP
IF (X(K) .GT. X(L)) THEN
	TEMP = X(K)
	X(K) = X(L)
	X(L) = TEMP

IF (MOD(N,2) .EQ. 0.0) THEN
MEDIAN=(X(N/2.0)+X((N/2.0)+1))/2.0
ELSE
MEDIAN=X((N+1)/2.0)
END IF
END IF
END DO
END DO
WRITE(2,10) NINT(MEDIAN)
10 FORMAT (10I10)
WRITE(*,*) 'MEDIAN IS', MEDIAN
CLOSE(1)
CLOSE(2)
RETURN
END SUBROUTINE

END MODULE
!MODULE FOR STD CALCULATION
MODULE STD
IMPLICIT NONE
REAL :: MEDIAN, DIN,MRP,CHL,DOX, MRPDOX

CONTAINS
SUBROUTINE THRESHOLDS(MRPDOX)
IMPLICIT NONE
REAL :: MEDIAN, DIN,MRP,CHL,DOX, MRPDOX

OPEN (20, FILE ='MEDIAN.DAT', STATUS = 'OLD')
READ (20,*) MEDIAN
WRITE(*,*) 'MEDIAN=', MEDIAN
CLOSE(20)

IF (MEDIAN .EQ. 0) THEN
   READ (*,*) 
   DIN = 2.60	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,10) DIN, MRP, CHL, DOX
   10 FORMAT (10F10.2)
  ELSE IF (MEDIAN .EQ. 1) THEN
   READ (*,*) 
   DIN = 2.53	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,11) DIN, MRP, CHL, DOX
   11 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 2) THEN
   READ (*,*) 
   DIN = 2.46	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,12) DIN, MRP, CHL, DOX
   12 FORMAT (10F10.2)

   ELSE IF (MEDIAN .EQ. 3) THEN
   READ (*,*) 
   DIN = 2.39	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,13) DIN, MRP, CHL, DOX
   13 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 4) THEN
   READ (*,*) 
   DIN = 2.32	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,14) DIN, MRP, CHL, DOX
   14 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 5) THEN
   READ (*,*) 
   DIN = 2.25	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,15) DIN, MRP, CHL, DOX
   15 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 6) THEN
   READ (*,*) 
   DIN = 2.18	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,16) DIN, MRP, CHL, DOX
   16 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 7) THEN
   READ (*,*) 
   DIN = 2.11	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,17) DIN, MRP, CHL, DOX
   17 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ.  THEN
   READ (*,*) 
   DIN = 2.04	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,18) DIN, MRP, CHL, DOX
   18 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 9) THEN
   READ (*,*) 
   DIN = 1.97	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,19) DIN, MRP, CHL, DOX
   19 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 10) THEN
   READ (*,*) 
   DIN = 1.89	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,20) DIN, MRP, CHL, DOX
   20 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 11) THEN
   READ (*,*) 
   DIN = 1.82	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,21) DIN, MRP, CHL, DOX
   21 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 12) THEN
   READ (*,*) 
   DIN = 1.75	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,22) DIN, MRP, CHL, DOX
   22 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 13) THEN
   READ (*,*) 
   DIN = 1.68	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,23) DIN, MRP, CHL, DOX
   23 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 14) THEN
   READ (*,*) 
   DIN = 1.61	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,24) DIN, MRP, CHL, DOX
   24 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 15) THEN
   READ (*,*) 
   DIN = 1.54	
   MRP = 60.00
   CHL = 15.00
   DOX = 70.00
   WRITE (*,25) DIN, MRP, CHL, DOX
   25 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 16) THEN
   READ (*,*) 
   DIN = 1.47	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.00
   WRITE (*,26) DIN, MRP, CHL, DOX
   26 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 17) THEN
   READ (*,*) 
   DIN = 1.40	
   MRP = 60.00
   CHL = 15.00
   DOX = 100.0
   WRITE (*,27) DIN, MRP, CHL, DOX
   27 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 18) THEN
   READ (*,*) 
   DIN = 1.34	
   MRP = 59.00
   CHL = 14.70
   DOX = 100.00
   WRITE (*,28) DIN, MRP, CHL, DOX
   28 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 19) THEN
   READ (*,*) 
   DIN = 1.27	
   MRP = 58.00
   CHL = 14.40
   DOX = 100.00
   WRITE (*,29) DIN, MRP, CHL, DOX
   29 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 20) THEN
   READ (*,*) 
   DIN = 1.21	
   MRP = 57.00
   CHL = 14.20
   DOX = 100.00
   WRITE (*,30) DIN, MRP, CHL, DOX
   30 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 21) THEN
   READ (*,*) 
   DIN = 1.14	
   MRP = 56.00
   CHL = 13.90
   DOX = 100.00
   WRITE (*,31) DIN, MRP, CHL, DOX
   31 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 22) THEN
   READ (*,*) 
   DIN = 1.08	
   MRP = 54.00
   CHL = 13.60
   DOX = 100.00
   WRITE (*,32) DIN, MRP, CHL, DOX
   32 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 23) THEN
   READ (*,*) 
   DIN = 1.02	
   MRP = 53.00
   CHL = 13.30
   DOX = 100.00
   WRITE (*,33) DIN, MRP, CHL, DOX
   33 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 24) THEN
   READ (*,*) 
   DIN = 0.95	
   MRP = 52.00
   CHL = 13.10
   DOX = 100.00
   WRITE (*,34) DIN, MRP, CHL, DOX
   34 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 25) THEN
   READ (*,*) 
   DIN = 0.89	
   MRP = 51.00
   CHL = 12.80
   DOX = 100.00
   WRITE (*,35) DIN, MRP, CHL, DOX
   35 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 26) THEN
   READ (*,*) 
   DIN = 0.83	
   MRP = 50.00
   CHL = 12.50
   DOX = 100.00
   WRITE (*,36) DIN, MRP, CHL, DOX
   36 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 27) THEN
   READ (*,*) 
   DIN = 0.76	
   MRP = 49.00
   CHL = 12.20
   DOX = 100.00
   WRITE (*,37) DIN, MRP, CHL, DOX
   37 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 28) THEN
   READ (*,*) 
   DIN = 0.70	
   MRP = 48.00
   CHL = 11.90
   DOX = 100.00
   WRITE (*,38) DIN, MRP, CHL, DOX
   38 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 29) THEN
   READ (*,*) 
   DIN = 0.63	
   MRP = 47.00
   CHL = 11.70
   DOX = 100.00
   WRITE (*,39) DIN, MRP, CHL, DOX
   39 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 30) THEN
   READ (*,*) 
   DIN = 0.57	
   MRP = 46.00
   CHL = 11.40
   DOX = 100.00
   WRITE (*,40) DIN, MRP, CHL, DOX
   40 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 31) THEN
   READ (*,*) 
   DIN = 0.51	
   MRP = 44.00
   CHL = 11.10
   DOX = 100.00
   WRITE (*,41) DIN, MRP, CHL, DOX
   41 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 32) THEN
   READ (*,*) 
   DIN = 0.44	
   MRP = 43.00
   CHL = 10.80
   DOX = 100.00
   WRITE (*,42) DIN, MRP, CHL, DOX
   42 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 33) THEN
   READ (*,*) 
   DIN = 0.38	
   MRP = 42.00
   CHL = 10.60
   DOX = 100.00
   WRITE (*,43) DIN, MRP, CHL, DOX
   43 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 34) THEN
   READ (*,*) 
   DIN = 0.31	
   MRP = 41.00
   CHL = 10.30
   DOX = 100.00
   WRITE (*,44) DIN, MRP, CHL, DOX
   44 FORMAT (10F10.2)
   ELSE IF (MEDIAN .EQ. 35) THEN
   READ (*,*) 
   DIN = 0.25	
   MRP = 40.00
   CHL = 10.00
   DOX = 100.00
   WRITE (*,45) DIN, MRP, CHL, DOX
   45 FORMAT (10F10.2)
   ELSE
   READ (*,*) 
   DIN = 0.0	
   MRP = 0.0
   CHL = 0.0
   DOX = 0.0
  WRITE (*,46) DIN, MRP, CHL, DOX
   46 FORMAT (10F10.2)

   END IF
  OPEN (21, FILE = 'STDDATA.DAT')
  WRITE(21, 47) DIN, MRP, CHL, DOX
  47 FORMAT (10F10.2)
  CLOSE(7)
  CLOSE(21)
  RETURN
END SUBROUTINE THRESHOLDS
END MODULE 

!MODULE 
MODULE SUBINDEX
IMPLICIT NONE
INTEGER :: N
REAL :: DIN, STDDIN, STDMRP, STDCHL, STDDOX
REAL :: SIDIN, MRP,SIMRP
INTEGER, PRIVATE :: NUMBERS
INTEGER :: I

CONTAINS
!SUBROUTINE FOR PARAMETERS STANDARDS CALCULATION
SUBROUTINE STDWQ(DOX)
IMPLICIT NONE
INTEGER :: N
REAL :: DIN, STDDIN, STDMRP, STDCHL, STDDOX
REAL :: SIDIN, MRP,DOX
INTEGER :: I, NUMBERS

OPEN (22, FILE = 'STDDATA.DAT', STATUS ='OLD')
READ (22,*) STDDIN, STDMRP, STDCHL, STDDOX
OPEN (23, FILE ='STDDIN.DAT')
OPEN (24, FILE ='STDMRP.DAT')
OPEN (25, FILE ='STDCHL.DAT')
OPEN (26, FILE ='STDDOX.DAT')
DO I = 1, 29
WRITE(23,50) STDDIN
WRITE(24,50) STDMRP
WRITE(25,50) STDCHL
WRITE(26,50) STDDOX
50 FORMAT (10F10.2)

END DO

CLOSE(22)
CLOSE(23)
CLOSE(24)
CLOSE(25)
CLOSE(26)
RETURN
  END SUBROUTINE 
!SUBROUTINE FOR DISSOLVED INORGANIC NITROGEN SUBINDEX 
SUBROUTINE SUBDIN(I,N,STDDIN)
IMPLICIT NONE
REAL :: DIN, STDDIN
REAL :: SIDIN
INTEGER :: I, N

OPEN (27, FILE = 'DIN08SUM.DAT', STATUS = 'OLD')
OPEN (28, FILE = 'STDDIN.DAT', STATUS = 'OLD') 
OPEN (29, FILE = 'SIDIN.DAT')
READ (27,*) N
DO I = 1, N
READ (27,*) DIN
READ (28,*) STDDIN

SIDIN = 100-((100*DIN)/STDDIN)
WRITE (29,54) SIDIN
 54 FORMAT (10F10.2)
END DO
CLOSE(27)
CLOSE(28)
CLOSE(29)
 RETURN
 END SUBROUTINE

!SUBROUTINE FOR (ORTHOPHOSPHATE) MRP SUBINDEX

SUBROUTINE SUBMRP(STDMRP)
IMPLICIT NONE
REAL :: STDMRP
REAL :: MRP, SIMRP
INTEGER :: I, N
OPEN(30, FILE = 'MRP08SUM.DAT', STATUS='OLD')
OPEN(31, FILE = 'STDMRP.DAT', STATUS='OLD')
OPEN(32, FILE = 'SIMRP.DAT')
READ (30,*) N
DO I = 1, N
READ (30,*) MRP
READ (31,*) STDMRP

SIMRP = 100-((100*MRP)/STDMRP)

WRITE (32,55)SIMRP
55 FORMAT (10F10.2)
END DO
CLOSE(30)
CLOSE(31)
CLOSE(32)
 RETURN
 END SUBROUTINE

!SUBROUTINE FOR CHLOROPHYLL SUBINDEX

SUBROUTINE SUBCHL(CHL,STDCHL)
IMPLICIT NONE
REAL :: STDCHL
REAL :: CHL, SICHL
INTEGER :: I, N
OPEN(33, FILE = 'CHL08SUM.DAT', STATUS='OLD')
OPEN(34, FILE = 'STDCHL.DAT', STATUS='OLD')
OPEN(35, FILE = 'SICHL.DAT')    
READ (33,*) N
DO I = 1, N
READ (33,*) CHL
READ (34,*) STDCHL

SICHL = 100-((100*CHL)/STDCHL)

WRITE (35,56)SICHL
56 FORMAT (10F10.2)
END DO
CLOSE(33)
CLOSE(34)
CLOSE(35)
 RETURN
 END SUBROUTINE

!SUBROUTINE FOR DISSOLVED OXYGEN (DO)SUBINDEX

SUBROUTINE SUBDOX(DOX,STDDOX)
IMPLICIT NONE
REAL :: STDDOX
REAL :: DOX, SIDOX
INTEGER :: I, N
OPEN(36, FILE = 'DOX08SUM.DAT', STATUS='OLD')
OPEN(37, FILE = 'STDDOX.DAT', STATUS='OLD')
OPEN(38, FILE = 'SIDOX.DAT')    
READ (36,*) N
DO I = 1, N
READ (36,*) DOX
READ (37,*) STDDOX

SIDOX = (100*DOX)/STDDOX

WRITE (38,57)SIDOX
57 FORMAT (10F10.2)
END DO
CLOSE(36)
CLOSE(37)
CLOSE(38)
 RETURN
 END SUBROUTINE
END MODULE SUBINDEX

!DATA CORRECTION
MODULE DATACORRECTION
IMPLICIT NONE
INTEGER :: NUMBERS
REAL:: SIDIN, SIMRP, SICHL, SIDOX

CONTAINS
!SUBROUTINE FOR DATA RECTIFICATION BY APPLYING SUBINDEX RULES
SUBROUTINE CORRECTION(NUMBERS)
IMPLICIT NONE
INTEGER :: NUMBERS
REAL :: SIDIN, SIMRP, SICHL, SIDOX
!DIN SUBINDEX CORRECTION
OPEN (39, FILE = 'SIDIN.DAT', STATUS ='OLD')
OPEN (40, FILE = 'SUBIDXDIN.DAT')
DO NUMBERS = 1, 29
READ(39,*) SIDIN
	IF ((SIDIN .GT. 100) .OR. (SIDIN .LT. 0.0)) THEN
       SIDIN = SIDIN*0.0
	   WRITE(40,12) SIDIN
	   12 FORMAT (10F10.2)
	   ELSE 
	   SIDIN = SIDIN*1 
   WRITE(40,13) SIDIN
   13 FORMAT (10F10.2)
 END IF
 END DO
  CLOSE(39)
  CLOSE(40)
!MRP SUBINDEX CORRECTION
OPEN (41, FILE = 'SIMRP.DAT', STATUS ='OLD')
OPEN (42, FILE = 'SUBIDXMRP.DAT')
DO NUMBERS = 1, 29
READ(41,*) SIMRP
	IF ((SIMRP .GT. 100) .OR. (SIMRP .LT. 0.0)) THEN
       SIMRP = SIMRP*0.0
	   WRITE(42,15) SIMRP
	   15 FORMAT (10F10.2)
	   ELSE 
	   SIMRP = SIMRP*1 
   WRITE(42,16) SIMRP
   16 FORMAT (10F10.2)
 END IF
   END DO

!CHL SUBINDEX CORRECTION
OPEN (43, FILE = 'SICHL.DAT', STATUS ='OLD')
OPEN (44, FILE = 'SUBIDXCHL.DAT')
DO NUMBERS = 1, 29
READ(43,*) SICHL
	IF ((SICHL .GT. 100) .OR. (SICHL .LT. 0.0)) THEN
       SICHL = SICHL*0.0
	   WRITE(44,17) SICHL
	   17 FORMAT (10F10.2)
	   ELSE 
	   SICHL = SICHL*1 	 
   WRITE(44,18) SICHL
   18 FORMAT (10F10.2)
 END IF
	  END DO
  
!DOX SUBINDEX CORRECTION
OPEN (45, FILE = 'SIDOX.DAT', STATUS ='OLD')
OPEN (46, FILE = 'SUBIDXDOX.DAT')
DO NUMBERS = 1, 29
READ(45,*) SIDOX
	IF (SIDOX .GT. 100) THEN
       SIDOX = 100.0
	WRITE(46,19) SIDOX
   19 FORMAT (10F10.2)
	   ELSE
	   SIDOX = SIDOX	 
   WRITE(46,20) SIDOX
   20 FORMAT (10F10.2)
END IF
END DO
CLOSE(41)
CLOSE(42)
CLOSE(43)
CLOSE(44)
CLOSE(45)
CLOSE(46)
RETURN
   END SUBROUTINE

END MODULE DATACORRECTION

!MODULE FOR ASTIM CALCULATES
MODULE ASTIM
IMPLICIT NONE
REAL :: SIDIN, SIMRP,SICHL,SIDOX, ASTI,WI
REAL :: SIWIDIN, SIWIMRP, SIWICHL,SIWIDOX
INTEGER, PRIVATE :: NUMBERS

CONTAINS
SUBROUTINE SIWI(SIWIDIN,SIWIDOX)
IMPLICIT NONE
REAL :: SIDIN, SIMRP,SICHL,SIDOX, ASTI,WI
REAL :: SIWIDIN, SIWIMRP, SIWICHL,SIWIDOX

INTEGER :: NUMBERS

OPEN (47, FILE ='SUBIDXDIN.DAT', STATUS = 'OLD')
OPEN (48, FILE ='SUBIDXMRP.DAT', STATUS = 'OLD')
OPEN (49, FILE ='SUBIDXCHL.DAT', STATUS = 'OLD')
OPEN (50, FILE ='SUBIDXDOX.DAT', STATUS = 'OLD')
OPEN (51, FILE ='WI.DAT', STATUS = 'OLD')
OPEN (52, FILE ='SIWIDIN.DAT', STATUS = 'UNKNOWN')
OPEN (53, FILE ='SIWIMRP.DAT', STATUS = 'UNKNOWN')
OPEN (54, FILE ='SIWICHL.DAT', STATUS = 'UNKNOWN')
OPEN (55, FILE ='SIWIDOX.DAT', STATUS = 'UNKNOWN')
READ(51,*) NUMBERS
DO NUMBERS = 1, 29
READ(47,*) SIDIN
READ(48,*) SIMRP
READ(49,*) SICHL
READ(50,*) SIDOX
READ(51,*) WI
 				  
	SIWIDIN = SIDIN*WI
	SIWIMRP = SIMRP*WI
	SIWICHL = SICHL*WI
	SIWIDOX = SIDOX*WI
	WRITE(52,60)SIWIDIN
	WRITE(53,60)SIWIMRP
	WRITE(54,60)SIWICHL
	WRITE(55,60)SIWIDOX
	60 FORMAT (10F10.2)
END DO

CLOSE(47)
CLOSE(48)
CLOSE(49)
CLOSE(50)
CLOSE(51)
CLOSE(52)
CLOSE(53)
CLOSE(54)
CLOSE(55)
RETURN
END SUBROUTINE SIWI 

!SUBROUTINE FOR ASTI CALCULATES
SUBROUTINE ASTICALCULATOR(SIWIDIN,SIWIDOX)
IMPLICIT NONE
REAL :: SIWIDIN,SIWIMRP,SIWICHL,SIWIDOX, ASTI
INTEGER :: NUMBERS

OPEN (19, FILE ='SIWIDIN.DAT', STATUS ='OLD')
OPEN (20, FILE ='SIWIMRP.DAT', STATUS ='OLD')
OPEN (21, FILE ='SIWICHL.DAT', STATUS ='OLD')
OPEN (22, FILE ='SIWIDOX.DAT', STATUS ='OLD')
OPEN (23, FILE ='ASTI.DAT', STATUS ='UNKNOWN')

DO NUMBERS =1, 29
 READ(19,*) SIWIDIN
 READ(20,*) SIWIMRP
 READ(21,*) SIWICHL
 READ(22,*) SIWIDOX

 ASTI = (SIWIDIN + SIWIMRP + SIWICHL + SIWIDOX)
 WRITE(23,*) NINT(ASTI)
 WRITE(*,*) ASTI

 END DO

 CLOSE(19)
 CLOSE(20)
 CLOSE(21)
 CLOSE(22)
 RETURN
 END SUBROUTINE ASTICALCULATOR

 END MODULE



!MAIN PROGRAM FOR CALCULATING 
!MAIN PROGRAM FOR CALCULATING 
PROGRAM ASTIMODEL
USE DATAMED
USE STD
USE SUBINDEX
USE DATACORRECTION
USE ASTIM


	   
 CALL MEDIANVALUE                      !SUBROUTINE FOR MEDIAN VALUE 
 CALL THRESHOLDS(MRPDOX)                !SUBROUTINE FOR STD THRESHOLDS FINDS
 CALL STDWQ(DOX)			!SUBROUTINE FOR STD WQ PARAMETERS 
 CALL SUBDIN(I,N,STDDIN)	        !SUBROUTINE FOR DIN SUBINDEX
 CALL SUBMRP(STDMRP)		         !SUBROUTINE FOR MRP SUBINDEX
 CALL SUBCHL(CHL,STDCHL)		!SUBROUTINE FOR CHL SUBINDEX
 CALL SUBDOX(DOX,STDDOX)		!SUBROUTINE FOR DOX SUBINDEX
 CALL CORRECTION(NUMBERS)               !SUBROUTINE FOR DATA RECTIFICATION
 CALL SIWI(SIWIDIN,SIWIDOX)             !SUBROUTINE FOR WQ PARAMETERS WEIGHT 
 CALL ASTICALCULATOR(SIWIDIN,SIWIDOX)   !SUBROUTINE CALL FOR ASTI CALCULATE

END PROGRAM 
0 Kudos
Steve_Lionel
Honored Contributor III
1,849 Views

You can attach source files rather than pasting a large program into a reply.

Line 125 is supposed to read:

 

 

 

 

ELSE IF (MEDIAN .EQ.  8 ) THEN

 

 

I think the forum turned it into an invisible emoji - I had to add a blank to disable that.

I would use SELECT CASE for these tests rather than a series of IF.

Line 700 calls MEDIANVALUE with no arguments, but the procedure takes two arguments. This may be what PowerStation was complaining about.

0 Kudos
uddin__md
Beginner
1,840 Views

@Steve_Lionel MANY THANKS FOR YOUR INSTANCE SUPPORT, UNFORTUNENTLY, LINE 125  DATA MISSID WHEN I PASTE INTO THIS PLATFORM, BUT MY MAIN PROGRAM IS OK, WHEN I CHECKED IT. THEN I RUN AGAIN BUT SIMILAR PROBLEM ARISEN. ALSO, I RUN THIS PROGRAM USING THE SILVERFORST COMPLILER. I FOUND SIMILAR ISSUES. DO YOU HAVE ANY RECCOMENDATIONS HOE COULD I SOLVE THIS ISSUES. MANY THANKS DEAR STEVE. 

0 Kudos
Steve_Lionel
Honored Contributor III
1,846 Views

I don't know your program. The call to MEDIANVALUE needs two arguments passed to it. But looking at the routine, it seems to want to do everything internally, so you could just delete "(X,N)" in the SUBROUTINE MEDIANVALUE line.

I can't say whether the rest of the calls after line 700 are correct, but at least they aren't invalid Fortran.

0 Kudos
uddin__md
Beginner
1,831 Views

Dear @Steve_Lionel , thank you so much for your support. It's solved my program issue by following your important suggestions. Now it is working fine and I got my target outputs.

 

Many thanks again

0 Kudos
mecej4
Honored Contributor III
1,829 Views

Uddin_md:

You wrote "ALSO, I RUN THIS PROGRAM USING THE SILVERFORST COMPLILER. I FOUND SIMILAR ISSUES. DO YOU HAVE ANY RECCOMENDATIONS HOE COULD I SOLVE THIS ISSUES."

I am afraid that what you are asking for is not reasonable, and nearly impossible.

A program is (I) an expression of ideas using (2) the syntax rules of a programming language, and there are often issues that arise when (3) using a compiler and running the program on a class of computers.

We can help with (2) and (3). With (1), if one of us happens to work in the same field, there is a chance of helping.

In the present case, I have to say that I know nothing about what your program is supposed to be doing. If you can describe the calculation, its purpose and algorithms used, some progress may be possible.

Nevertheless, you should seek help from the author of the program, if the author is known and available.

Or, better, write your own program and then you will be in a better position to discuss its behavior and shortcomings.

0 Kudos
Reply