A Hollerith constant consists of an unsigned, nonzero, integer constant, followed by the letter H, followed by a string of printable characters where the integer constant designates the number of characters in the string, including any spaces and tabs.
A Hollerith constant occupies 1 byte of storage for each character.
A Hollerith constant is aligned on 2-byte boundaries.
The FORTRAN standard does not have this old Hollerith notation, although the standard recommends implementing the Hollerith feature to improve compatibility with old programs.
Hollerith data can be used in place of character-string constants. They can also be used in IF tests, and to initialize noncharacter variables in DATA statements and assignment statements, though none of these are recommended, and none are standard. These are typeless constants.
CHARACTER C*1, CODE*2 INTEGER TAG*2 DATA TAG / 2Hok / CODE = 2Hno IF ( C .EQ. 1HZ ) CALL PUNT
The rules and restrictions on Hollerith constants are:
The number of characters has no practical limit.
The characters can continue over to a continuation line, but that gets tricky. Short standard fixed format lines are padded on the right with blanks up to 72 columns, but short tab-format lines stop at the newline.
If a Hollerith constant is used with a binary operator, it gets the data type of the other operand.
If you assign a Hollerith constant to a variable, and the length of the constant is less than the length of the data type of the variable, then spaces (ASCII 32) are appended on the right.
If the length of a Hollerith constant or variable is greater than the length of the data type of the variable, then characters are truncated on the right.
If a Hollerith constant is used as an actual argument, it is passed as a 4-byte item.
If a Hollerith constant is used, and the context does not determine the data type, then INTEGER*4 is used.