Next: Variable FORMAT expressions, Previous: STRUCTURE and RECORD, Up: Extensions not implemented in GNU Fortran
ENCODE
and DECODE
statements
GNU Fortran does not support the ENCODE
and DECODE
statements. These statements are best replaced by READ
and
WRITE
statements involving internal files (CHARACTER
variables and arrays), which have been part of the Fortran standard since
Fortran 77. For example, replace a code fragment like
INTEGER*1 LINE(80) REAL A, B, C c ... Code that sets LINE DECODE (80, 9000, LINE) A, B, C 9000 FORMAT (1X, 3(F10.5))
with the following:
CHARACTER(LEN=80) LINE REAL A, B, C c ... Code that sets LINE READ (UNIT=LINE, FMT=9000) A, B, C 9000 FORMAT (1X, 3(F10.5))
Similarly, replace a code fragment like
INTEGER*1 LINE(80) REAL A, B, C c ... Code that sets A, B and C ENCODE (80, 9000, LINE) A, B, C 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
with the following:
CHARACTER(LEN=80) LINE REAL A, B, C c ... Code that sets A, B and C WRITE (UNIT=LINE, FMT=9000) A, B, C 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))