Hollerith data

Hollerith data is not part of the Fortran standard although it was included in Fortran 66. In FTN95 they have been implemented as extensions to the Standard for compatibility with FTN77. Occurrences of Hollerith data are flagged as a warning by the compiler. New programs should not use these two extensions.

Note: Hollerith editing in formats is still part of the Standard.

For example:

10 FORMAT(4HFRED)

is equivalent to:

10 FORMAT('FRED')

Hollerith data is stored as two 8-bit characters per word, any unused character positions being blank-filled.

The number of characters contained by each type of variable is as follows:

 

Type

Number of
Hollerith
Characters

INTEGER(KIND=1)
LOGICAL(KIND=1)

1

INTEGER(KIND=2)
LOGICAL(KIND=2)

2

INTEGER(KIND=3)
LOGICAL(KIND=3)
REAL(KIND=1)

4

REAL(KIND=2)

8

REAL(KIND=3)

10

 

Hollerith data is allowed in FTN95 as follows:

  1. In DATA statements for variables and arrays of type INTEGER and REAL. For example:

      REAL(2) :: A(3)
      INTEGER(3) :: IB(2)
      DATA A/24HABCDEFGHIJKLMNOPQRSTUVWX/
      DATA IB/8H01234567/

Note that apostrophes can be used as an alternative to the nH form.

  1. As data read by READ and WRITE statements; for example:

      READ(1,10)I
 10   FORMAT(A2)

An Aw edit descriptor is used to specify that ASCII characters are to be read into or written from the specified variables which may be of type INTEGER, REAL, DOUBLE PRECISION or LOGICAL. FTN95 allows the form A (alone) where w is assumed to be the number of ASCII characters that will fit into the variable in the input/output list. For example:

      INTEGER(2) :: I
      REAL(1) :: R
      LOGICAL(3) :: L
      READ(1,10)I,R,L
 10   FORMAT(3A)

would read, from a single record, 2 characters into I, 4 characters into R and 4 characters into L.

  1. In assignment statements where the left hand side is an arithmetic variable or array element, for example:

      I = 'AB'
      R = '1234'

Note the use of apostrophes in these examples.

  1. In subroutine calls or function references, for example:

      CALL PIANO(5HFORTE)
      I = RS(1HA,8)

A run-time error will be generated when using the compile-time option /CHECK, if a Hollerith string is passed as an actual routine argument and the corresponding dummy argument is not of type CHARACTER.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited