Next: , Previous: FLUSH Statement, Up: Missing Features

15.3.15 Expressions in FORMAT Statements

g77 doesn't support `FORMAT(I<J>)' and the like. Supporting this requires a significant redesign or replacement of libg2c.

However, g77 does support this construct when the expression is constant (as of version 0.5.22). For example:

           PARAMETER (IWIDTH = 12)
     10    FORMAT (I<IWIDTH>)

Otherwise, at least for output (PRINT and WRITE), Fortran code making use of this feature can be rewritten to avoid it by constructing the FORMAT string in a CHARACTER variable or array, then using that variable or array in place of the FORMAT statement label to do the original PRINT or WRITE.

Many uses of this feature on input can be rewritten this way as well, but not all can. For example, this can be rewritten:

           READ 20, I
     20    FORMAT (I<J>)

However, this cannot, in general, be rewritten, especially when ERR= and END= constructs are employed:

           READ 30, J, I
     30    FORMAT (I<J>)