# What do we mean by common?

**URL:** <https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058>\
**Category:** Uncategorized\
**Created:** [October 12, 2021, 5:35pm UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058 "2021-10-12T17:35:38Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![everythingfunctional](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/everythingfunctional/32/176_2.png) [@everythingfunctional](https://fortran-lang.discourse.group/u/everythingfunctional)\
**Post date:** [October 19, 2021, 12:20am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/21 "2021-10-19T00:20:06Z")

</div>

You certainly could just put `module thing` `end module` before the start of the main program and then `use` that module. I would recommend adding a `program main` statement as well. I would recommend then putting the module and main program in separate files, and then working to split the module into separate modules with reasonable organization.

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [October 19, 2021, 1:26am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/22 "2021-10-19T01:26:12Z")

</div>

> [@garynewport](#):
>
> The code I have just opens up into the initial routine

It is unusual for code to open itself up.

What do you mean by “initial routine”? The first routine in some source file, or the first routine that will be executed, …?

---

<div class="post-metadata">

**Author:** ![garynewport](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@garynewport](https://fortran-lang.discourse.group/u/garynewport)\
**Post date:** [October 19, 2021, 5:30am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/23 "2021-10-19T05:30:34Z")

</div>

I have now done exactly that; thank you.

---

<div class="post-metadata">

**Author:** ![garynewport](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@garynewport](https://fortran-lang.discourse.group/u/garynewport)\
**Post date:** [October 19, 2021, 5:33am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/24 "2021-10-19T05:33:29Z")

</div>

I meant that, on execution, the program would encounter an instruction without any ‘main’ declaration; so…

```auto
print *, “hello”

```

rather than

```auto
program main

   print *, “hello”

end program

```

I am aware programs do not just open. 🙂

---

<div class="post-metadata">

**Author:** ![JohnCampbell](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@JohnCampbell](https://fortran-lang.discourse.group/u/JohnCampbell)\
**Post date:** [October 19, 2021, 7:03am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/25 "2021-10-19T07:03:10Z")

</div>

Regarding the original post, I would recommend to not be too aggressive in changes.  
I would however recommend one change that will require extensive review of the original code, by placing IMPLICIT NONE as the first line of each routine.  
This will also require that all INCLUDE files are enhanced to include explicit type definition of all variables listed, which is ok and preferable for INCLUDE files  
IMPLICIT NONE effectively becomes a spelling check for all variables listed in the type declarations.  
With most IDE’s this should not be too difficult and could be time well spent for identifying and documenting all variables used in each routine.

Your COMMON include file could become something like:

```
  COMMON / ZONEC / SFILE,OFILE,PFILE,LFILE,FILEZ
  character(len=32) :: SFILE,OFILE,PFILE,LFILE,FILEZ

  COMMON / ZONES / radM,radR,Nrad, &
 & unitz,start_zones,increment_zones,iunit,lunit
  real :: radM, radR, unitz, start_zones
  integer :: Nrad, increment_zones, iunit, lunit

```

If I am correct assuming type character for file names, it may be better to not mix character with integer/real variables in the same common. It is acceptable to have two COMMON in the same include file. Converting to character variables where clearly used is also useful and probably shows the original fortran was pre F77.  
Note also that with pre Fortran 77, FORTRAN did not use generic intrinsics so if double precision (REAL\*8) was used, expect DSIN instead of SIN, FLOAT instead of REAL or DABS instead of ABS. Moving to generic intrinsics is also a useful update that can clarify the code, once the program is basically working.

For the other INCLUDE file you could consider:  
INTEGER, PARAMETER :: MJ = 4000  
INTEGER, PARAMETER :: MH = 4  
INTEGER, PARAMETER :: ME = 9  
INTEGER, PARAMETER :: MTAU = 20000

When not using punch cards, code layout becomes a little/lot easier.  
Moving to free format gives a longer code line, but can require a lot of care for continuation or FORMAT statements.

---

<div class="post-metadata">

**Author:** ![garynewport](https://avatars.discourse-cdn.com/v4/letter/g/898d66/32.png) [@garynewport](https://fortran-lang.discourse.group/u/garynewport)\
**Post date:** [October 19, 2021, 7:19am UTC](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058/26 "2021-10-19T07:19:14Z")

</div>

There is so much to unpick here; thank you so much!

I will go through this in detail once I have time but just to state that, yes, I am doing ‘implicit none’ for the reason given. 🙂

[Previous page](https://fortran-lang.discourse.group/t/what-do-we-mean-by-common/2058.md?page=1)
