Topic: Error: End of implied-do loop at (1) could not be simplified ....

In the code below, c1 works, but c2 fails.
Here, c1 puts 25 in the loop.
But c2 using nspect=25.
And c2 gives:

       DATA (DOPFAC(i),i=1,nspect)
                        1
Error: end of implied-do loop at (1) could not be simplified to a constant value


      PROGRAM test01                                                 
       
      integer nspect/25/
      Parameter(MMOLT=77)
     
      COMMON/BMDCOM/DOPFAC(mmolt)

      write(*,*) 'MMOLT = ', MMOLT
      write(*,*) 'nspect = ', nspect

c1      DATA (DOPFAC(i),i=1,25)

c2 Error: end of implied-do loop at (1) could not be simplified to a constant value
      DATA (DOPFAC(i),i=1,nspect)
     1 /1.3945E-6, 0.8922E-6, 0.8543E-6, 0.8921E-6, 1.1183E-6,     
     2  1.4777E-6, 1.0463E-6, 1.0805E-6, 0.7395E-6, 0.8726E-6,
     3  1.4342E-6, 0.7456E-6, 5.04981E-07, 5.38245E-07, 5.79088E-07,
     4  6.30907E-07, 6.36486E-07, 4.32375E-07, 4.52709E-07, 4.76212E-07,
     5  5.99528E-07,6.65841E-07,5.83391E-07,4.7721E-07,5.69488E-07/
     
      do 10, i=1,5
      m=(i-1)*5+1
      n=m+4
      write(*,*) 'DOPFAC = ', DOPFAC(m:n)
   10 continue
     
      STOP
      end

Re: Error: End of implied-do loop at (1) could not be simplified ....

I think the error is relatively self-explanatory.  The loop needs nspect to be a constant, but it's just a variable with an initial value in this case.  You'll need to declare nspect as a parameter.

Jeff Armstrong
Approximatrix, LLC