title: Blank spaces in FORTRAN
body: <p>I am trying to compile the following example code, which I embedded in a subroutine:</p>
  
  <pre><code>      module wallforcing
        use shared_module
        contains
  
        subroutine phicontrol
  
          EXTERNAL  FEX
          INTEGER  IOPT, IOUT, ISTATE, ITASK, ITOL, IWORK(23), LIW, LRW,
       &amp;              MF, NEQ
          DOUBLE PRECISION  ATOL(3), RTOL, RWORK(58), T, TOUT, Y(3)
          NEQ = 3
          Y(1) = 1.D0
          Y(2) = 0.D0
          Y(3) = 0.D0
          T = 0.D0
          TOUT = .4D0
          ITOL = 2
          RTOL = 1.D-4
          ATOL(1) = 1.D-6
          ATOL(2) = 1.D-10
          ATOL(3) = 1.D-6
          ITASK = 1
          ISTATE = 1
          IOPT = 0
          LRW = 58
          LIW = 23
          MF = 21
          DO 40 IOUT = 1,12
            CALL DLSODE (FEX, NEQ, Y, T, TOUT, ITOL, RTOL, ATOL, ITASK,
       &amp;              ISTATE, IOPT, RWORK, LRW, IWORK, LIW, JEX, MF)
            WRITE(6,20)  T, Y(1), Y(2), Y(3)
      20 FORMAT(' At t =',D12.4,'   y =',3D14.6)
              IF (ISTATE .LT. 0)  GO TO 80
      40 TOUT = TOUT*10.D0
            WRITE(6,60)  IWORK(11), IWORK(12), IWORK(13)
      60 FORMAT(/' No. steps =',i4,',  No. f-s =',i4,',  No. J-s =',i4)
            STOP
      80 WRITE(6,90)  ISTATE
      90 FORMAT(///' Error halt.. ISTATE =',I3)
            STOP
          END
  C
  C        SUBROUTINE  JEX (NEQ, T, Y, ML, MU, PD, NRPD)
  C        INTEGER  NEQ, ML, MU, NRPD
  C        DOUBLE PRECISION  T, Y(3), PD(NRPD,3)
  C        PD(1,1) = -.04D0
  C        PD(1,2) = 1.D4*Y(3)
  C        PD(1,3) = 1.D4*Y(2)
  C        PD(2,1) = .04D0
  C        PD(2,3) = -PD(1,3)
  C        PD(3,2) = 6.D7*Y(2)
  C        PD(2,2) = -PD(1,2) - PD(3,2)
  C        RETURN
  C        END
  C
  c       return
         end subroutine phicontrol
  C        SUBROUTINE  FEX (NEQ, T, Y, YDOT)
  C        INTEGER  NEQ
  C        DOUBLE PRECISION  T, Y(3), YDOT(3)
  C        YDOT(1) = -.04D0*Y(1) + 1.D4*Y(2)*Y(3)
  C        YDOT(3) = 3.D7*Y(2)*Y(2)
  C        YDOT(2) = -YDOT(1) - YDOT(3)
  C        RETURN
  C        END
         end module wallforcing
  </code></pre>
  
  <p>I get a bunch of errors, which I think are related to a bad treatment of blank spaces:</p>
  
  <pre><code>wallcontrol.f(35): error #5082: Syntax error, found INTEGER_CONSTANT '0' when ex   pecting one of: ( * ) :: , &lt;END-OF-STATEMENT&gt; ; + . - % (/ [ : ] /) . ' ** / ...
          20 FORMAT(' At t =',D12.4,'   y =',3D14.6)
  ---------^
  wallcontrol.f(35): error #5082: Syntax error, found REAL_CONSTANT '.4' when expe   cting one of: ( * ) :: , + . - % : . ** / // .LT. &lt; .LE. &lt;= .EQ. == .NE. ...
          20 FORMAT(' At t =',D12.4,'   y =',3D14.6)
  -------------------------------^
  wallcontrol.f(35): error #5082: Syntax error, found REAL_CONSTANT '.6' when expe   cting one of: * ) :: , &lt;END-OF-STATEMENT&gt; ; + . - (/ [ : ] /) ' ** / // &gt; .LT. .   ..
          20 FORMAT(' At t =',D12.4,'   y =',3D14.6)
  -----------------------------------------------^
  wallcontrol.f(60): error #6786: This is an invalid statement; an END [MODULE] st   atement is required.
         end subroutine phicontrol
  -------^
  wallcontrol.f(60): error #6785: This name does not match the unit name.   [PHICO   NTROL]
         end subroutine phicontrol
  ----------------------^
  wallcontrol.f(44): error #6378: SUBROUTINE must be present on the end-subroutine   -stmt of an internal or module subroutine
          END
  ^
  wallcontrol.f(31): error #6321: An unterminated block exists.
          DO 40 IOUT = 1,12
  ^
  wallcontrol.f(31): error #6323: This label is not defined in this scoping unit.      [40]
          DO 40 IOUT = 1,12
  -----------^
  wallcontrol.f(69): error #6790: This is an invalid statement; an END [PROGRAM]     statement is required.
         end module wallforcing
  -------^
  wallcontrol.f(69): error #6785: This name does not match the unit name.   [WALLF   ORCING]
         end module wallforcing
  ------------------^
  compilation aborted for wallcontrol.f (code 1)
  </code></pre>
  
  <p>What's wrong in the code? Coming from other programming languages, I find weird how FORTRAN messes up with blank spaces. Is there any good tutorial on this topic?</p>