Silverfrost Forums

Welcome to our forums

Common block variables - include files

4 Jun 2010 4:13 #6503

Hi,

I had so much success with solving my last problem in this forum that I'll try again. I have an existing fortran program that contains a lot of 'include' files in which common block variables are declared in the following way:

common /stpdat/ytran(2,MAXSOIL,MAXPROD,73,MAXDPTHS), - yevap(2,MAXSOIL,MAXPROD,73,MAXDPTHS), - yswc(2,MAXSOIL,MAXPROD,73,MAXDPTHS), - germ(2,MAXSOIL,MAXPROD,366)

  real      ytran,yevap,yswc

  integer      germ

When I try to compile this in silverfrost it gives me the error message:

germ is NOT an array etc.

Is this way of declaring variables not acceptable in Silverfrost? If it is acceptable, then it may also have something to do with how I include the variable files in the code:

I'm using the command line: include file='variables.inc'

Related to this: I also got a lot of error messages saying that there is a problem with the 'statement order': I generally include my variables.inc file at the very beginning of the programme/ subroutine because I need some of the variables in there to declare my arrays in the subroutines.

Any suggestions?

Thanks

Tamara

5 Jun 2010 2:08 #6506

I am not sure about your questions.

The line ' include file='variables.inc' ' includes the code in that file into your program file. It should not be on the command line. It should be in every subroutine or function that used these variables, as it merely includes the code lines. It does not work like CONTAINS in a MODULE.

Make sure you are not mixing free format and fixed format fortran code. These interpret continuation selection differently. I now only use free-format.

'germ(2,MAXSOIL,MAXPROD,366)' requires the integer parameters MAXSOIL and MAXPROD to be defined earlier in the routine or include file.

I hope these comments help.

5 Jun 2010 5:43 #6507

Include files, modules and common blocks can be combined in various ways. For instance, common blocks can be used within include files. Example, file 'files.inc' (used below):

      external       search_f
      integer*4      x_nr,mzl
      character*3    x_ext(10)
      character*120  xfile(10)

      parameter    (mzl=100000)

      common  /search_dat/ xfile,x_ext,x_nr

Within the programme, subroutines and/or functions then the sequence is:

c     name
      INTEGER FUNCTION RAS_I()

c     module(s)
      USE M_FREEIMA

      IMPLICIT NONE
      INCLUDE <WINDOWS.INS>

c     include file(s)
      include        'c:\\lisa_g\\files.inc'

c     declarations
      character*1    buffer1(mzl),buffer2(mzl),buffer3(mzl)

      integer*2,allocatable::BUFFER8(:)

      integer*4      iii(8)
      real*8         xmin,xmax,ymin,ymax,zmin,zmax
      logical*2      ll
      character*120  afile(1000)

c     common block(s)
      common  /tr_par/   ell,pi,rad,rho,ell_a,ell_b,ell_e,ell_f,zbr

Regards, Wilfried

7 Jun 2010 8:10 #6514

Just post your code here or somewhere. Sure, people, both users and developers, are very helpful in this forum. It is much easier and extremely more efficient to demonstrate to the novice compiler/computer logics (decently, pretty twisted from human one) and other things after he/she tried and failed. Most probably your problem is just a millisecond for most of pros here, so they will be happy to get one more new happy fan of this great compiler.

( I can estimate Steve Lionel, one of developers of Intel Visual Fortran who always takes his time to help literally everyone who asks IVF related questions on the forums or emails, converted tens of thousand people into loyal IVF users just using his generosity and personal charm 😃 . Aside from that, that's tens of millions of dollars of revenue for the company. And the more users - the less bugs.)

Please login to reply.