UW AMath High Performance Scientific Computing
 
Coursera Edition

Previous topic

Storing information in binary

Next topic

Python and Fortran

This Page

Punch cardsΒΆ

Once upon a time (through the 1970s) many computer programs were written on punch cards of the type shown here [image source]:

_images/FortranCardPROJ039-agr.jpg

This is a form of binary memory (see Storing information in binary) where a specific set of locations each has a hole punched (representing 1) or not (representing 0). Each character typed on the top line is represented by the bits reading down the corresponding column, e.g. the first character Z is represented by 001000000001 since there are only two holes punched in this column.

When programs were written on cards, one card was required for each line of the program. The early conventions of the Fortran programming language are related to the columns on a punch card. Only the first 72 columns were used for the program statements. The last 8 columns could be used to print a card number, so that the unlucky programmer who dropped a deck of cards had some chance of reordering them properly. Many Fortran 77 compilers still ignore any characters beyond column 72 in a line of a program, leading to bugs that can be hard to find if care is not taken, e.g. a called xnew might be truncated to x if the x is in column 72. If the program also uses a variable called x, this will not be caught by the compiler.

A program would require a punch card deck as shown in this photo [image source]:

_images/PunchCardDecks-agr.jpg

Punch cards were a great step forward from punched tape [wikipedia] where a long strip of paper was used to store the entire program (and making a mistake required retyping more than just one card).