Ever wonder how punch cards worked? Before the advent of programs that could just be edited on a machine, programmers had to deal with punch cards. Doesn’t seem like a big deal to us. But what was involved in using these punch cards? Punch cards meant that every line of code in a program had to have its own card. So if your program had 1000 LOC, then you had 1000 cards. Don’t trip now…
Now most punch cards, had the statement they represented printed at the top of the card. The example above shows the statement Z(1) = Y + W(1). This Fortran card has 80-columns, and shows clearly the 7 columns of the fixed formatting. Now interpreting the card (lets assume we don’t know what’s on it), requires using EBCD, a subset of EBCDIC (Extended Binary Coded Decimal Interchange Code).
Notice that there are nine rows numbers 1 to 9, a row 0, and two unmarked rows above that which are usually marked Y and below that X. Each character of the statement is encoded using 0-3 punches in the card, with 0 representing a space. For example, Z is encoded as a punch in 0 and 9. Using the table below, one can see that the intersection of 0-9 is Z. The value 1 has only one punch in the 1. The coding for +mis Y-6-8.
Of course there were many different types of cards as well. This allows for 64 characters to be used in a program. In todays perspective this isn’t a lot. Notice what’s missing? Lowercase characters. This is one of the reasons early programming were coded in uppercase, and not lowercase. It would of course have been possible to increase the size of the card to accommodate lowercase characters, or an extended character set, but that might have impacted the structural integrity of the card, and may have required making a thicker card.
Check out this video on how to make punch cards:
We don’t know how lucky we are.