Previous: ENCODE and DECODE statements, Up: Extensions not implemented in GNU Fortran


6.2.3 Variable FORMAT expressions

A variable FORMAT expression is format statement which includes angle brackets enclosing a Fortran expression: FORMAT(I<N>). GNU Fortran does not support this legacy extension. The effect of variable format expressions can be reproduced by using the more powerful (and standard) combination of internal output and string formats. For example, replace a code fragment like this:

           WRITE(6,20) INT1
      20   FORMAT(I<N+1>)

with the following:

     c     Variable declaration
           CHARACTER(LEN=20) F
     c
     c     Other code here...
     c
           WRITE(FMT,'("(I", I0, ")")') N+1
           WRITE(6,FM) INT1

or with:

     c     Variable declaration
           CHARACTER(LEN=20) FMT
     c
     c     Other code here...
     c
           WRITE(FMT,*) N+1
           WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1