Information about Hollerith Constant
Hollerith constants, named in honor of Herman Hollerith, were used in early FORTRAN programs to allow manipulation of character data.
Early FORTRAN had no
By the FORTRAN 66 Standard, Hollerith syntax was allowed in the following uses:
Some authors were of the opinion that for best portability, only a single character should be used per data item. However considering the small memory sizes of machines of the day, this technique was considered extremely wasteful.
One of the major features of FORTRAN 77 was the
Hollerith constants were deleted from the FORTRAN 77 Standard, though still described in a appendix for those wishing to continue support. Hollerith edit descriptors were allowed through Fortran 90, and were deleted from the Fortran 95 Standard.
C PROGRAM HELLO1 C INTEGER IHWSTR(3) DATA IHWSTR/4HHELL,4HO WO, 3HRLD/ C WRITE (6,100) IHWSTR STOP 100 FORMAT (3A4) END
Besides
C PROGRAM HELLO2 CALL WRTOUT (11HHELLO WORLD, 11) STOP END C SUBROUTINE WRTOUT (IARRAY, NCHRS) C INTEGER IARRAY(1)[1] INTEGER NCHRS C INTEGER ICPW DATA ICPW/4/[2] INTEGER I, NWRDS C NWRDS = (NCHRS + ICPW - 1)/ICPW WRITE (6,100) (IARRAY(I),I=1,NWRDS) RETURN 100 FORMAT (100A4)[3] END
Although technically not a Hollerith constant, the same Hollerith syntax was allowed as an edit descriptor in
C PROGRAM HELLO3 WRITE (6,100) STOP 100 FORMAT (11HHELLO WORLD) END
One of the most surprising features (only for newbies, of course) was the behaviour of Hollerith edit descriptors when used for input. The following program would change at run time
C PROGRAM WHAT1 READ (5,100) WRITE (6,100) STOP 100 FORMAT (11HHELLO WORLD) END
Early FORTRAN had no
CHARACTER data type; only numeric types. In order to perform character manipulation, characters needed to be placed into numeric variables via Hollerith constants. For example the constant 3HABC specified a three-character string 'ABC'. These constants were typeless, so that there were no type conversion issues. If the constant specified fewer characters than was possible to hold in a data item, the characters were then stored in the item left-justified and blank-filled.
By the FORTRAN 66 Standard, Hollerith syntax was allowed in the following uses:
- As constants in
DATAstatements - As constant actual arguments in procedure calls
- As edit descriptors in
FORMATstatements
Some authors were of the opinion that for best portability, only a single character should be used per data item. However considering the small memory sizes of machines of the day, this technique was considered extremely wasteful.
One of the major features of FORTRAN 77 was the
CHARACTER string data type. Use of this data type dramatically simplified character manipulation in Fortran programs - rendering almost all uses of the Hollerith constant technique obsolete.
Hollerith constants were deleted from the FORTRAN 77 Standard, though still described in a appendix for those wishing to continue support. Hollerith edit descriptors were allowed through Fortran 90, and were deleted from the Fortran 95 Standard.
EXAMPLES
The following is a FORTRAN 66 hello world program using Hollerith constants. It assumes that at least four characters per word are supported by the implementation:C PROGRAM HELLO1 C INTEGER IHWSTR(3) DATA IHWSTR/4HHELL,4HO WO, 3HRLD/ C WRITE (6,100) IHWSTR STOP 100 FORMAT (3A4) END
Besides
DATA statements, Hollerith constants were also allowed as actual arguments in procedure calls. However there was no way that the callee could know how many characters were passed in. The programmer had to pass the information explicitly. The hello world program could be written as follows - on a machine where four characters are stored in a word:
C PROGRAM HELLO2 CALL WRTOUT (11HHELLO WORLD, 11) STOP END C SUBROUTINE WRTOUT (IARRAY, NCHRS) C INTEGER IARRAY(1)[1] INTEGER NCHRS C INTEGER ICPW DATA ICPW/4/[2] INTEGER I, NWRDS C NWRDS = (NCHRS + ICPW - 1)/ICPW WRITE (6,100) (IARRAY(I),I=1,NWRDS) RETURN 100 FORMAT (100A4)[3] END
1. ^ FORTRAN 66 did not have a way to indicate a variable-sized array. So a '1' was typically used to indicate that the size is unknown.
2. ^ Four characters per word.
3. ^ A count of 100 is a 'large enough' value that any reasonable number of characters can be written. Also note that four characters per word is hard-coded here too.
2. ^ Four characters per word.
3. ^ A count of 100 is a 'large enough' value that any reasonable number of characters can be written. Also note that four characters per word is hard-coded here too.
Although technically not a Hollerith constant, the same Hollerith syntax was allowed as an edit descriptor in
FORMAT statements. The hello world program could also be written as:
C PROGRAM HELLO3 WRITE (6,100) STOP 100 FORMAT (11HHELLO WORLD) END
One of the most surprising features (only for newbies, of course) was the behaviour of Hollerith edit descriptors when used for input. The following program would change at run time
HELLO WORLD to whatever would happen to be the next eleven characters in the input stream and print that input:
C PROGRAM WHAT1 READ (5,100) WRITE (6,100) STOP 100 FORMAT (11HHELLO WORLD) END
Herman Hollerith (February 29, 1860 – November 17, 1929) was a German-American statistician who developed a mechanical tabulator based on punched cards in order to rapidly tabulate statistics from millions of pieces of data.
..... Click the link for more information.
..... Click the link for more information.
Fortran
Paradigm: multi-paradigm: procedural, imperative, structured, object-oriented
Appeared in: 1957
Designed by: John W. Backus
Developer: John W.
..... Click the link for more information.
Paradigm: multi-paradigm: procedural, imperative, structured, object-oriented
Appeared in: 1957
Designed by: John W. Backus
Developer: John W.
..... Click the link for more information.
In programming languages a data type defines a set of values and the allowable operations on those values[1]. For example, in the Java programming language, the "int" type represents the set of 32-bit integers ranging in value from -2,147,483,648 to 2,147,483,647, and
..... Click the link for more information.
..... Click the link for more information.
word" is a term for the natural unit of data used by a particular computer design. A word is simply a fixed-sized group of bits that are handled together by the machine. The number of bits in a word (the word size or word length
..... Click the link for more information.
..... Click the link for more information.
A "hello world" program is a computer program that prints out "Hello, World!" on a display device. It is used in many introductory tutorials for teaching a programming language. Such a program is typically one of the simplest programs possible in a computer language.
..... Click the link for more information.
..... Click the link for more information.
A "hello world" program is a computer program that prints out "Hello, World!" on a display device. It is used in many introductory tutorials for teaching a programming language. Such a program is typically one of the simplest programs possible in a computer language.
..... Click the link for more information.
..... Click the link for more information.
A "hello world" program is a computer program that prints out "Hello, World!" on a display device. It is used in many introductory tutorials for teaching a programming language. Such a program is typically one of the simplest programs possible in a computer language.
..... Click the link for more information.
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus