Intel's Ronler Acres Plant

Silicon Forest
If the type is too small, Ctrl+ is your friend

Thursday, July 24, 2008

Goto

Goto? What's that? Spanish for duck? Greek for tarantula? How would you pronouce it? Got-oh, like in "Got Milk"?

No, no, no. Goto is why programmers can't spell. Goto is short for "go to". Wow, you save a whole space. It's an instruction used in computer programs to arbitrarily change the point of execution. Back in the good old days, when Fortran was the king of beasts, goto's were the only way to change course in a computer program.


IBM Keypunch Machine
Back in the good old days, computer programs were written on punched cards. You sat at a keypunch machine and typed in one line of your program at a time. As you typed, the keypunch machine typed the letter on the top line of the card and punched a series of holes representing the machine code for that letter in a column beneath the letter. If you made a mistake, the card went in the trash, and you started over with a fresh card.

Most of my early programs were pretty small, on the order of a hundred cards or so. You take your deck of punched cards and hand them in to the opertor who loads them in the card reader, one program/job after another. There were always a dozen or two people in there. The computer reads the cards, compiles the program, runs the program, and then queues the output to the printer. The operator seperates the output from the printer into seperate jobs and turns them over to the waiting geeks/students.

You looked at the output to see, first of all, if your program compiled correctly. If it didn't, it was back to the keypunch machine to correct your typing errors. If it did compile correctly, you looked at the output to see if the program performed as expected. Simple programs were easy to debug. More complex programs, well, then you got to strain your brain.


If you were only dealing with a hundred cards or so, things were not too tough. But some people, especially in engineering were running massive programs that might be one or two thousand lines/cards long. These required boxes to carry around, and don't dare drop them. You might never be able to put Humpty together again.

There was one story floating around that this happened to one poor guy, and to ensure that it never caused him a problem again, he added a goto to every line of his program. The version of Fortran we were using was an advanced (!) version: it allowed two statements on each line. What our hero did is he gave each line of his program a label (Fortran uses numbers in the first few columns), and tacked on a second statement to end of each program line. The second statement was simply a GOTO directing the program to the next line.

Take the box of cards, drop it on the ground. Gather up the cards in any random order, just make sure the first card is first, and turn them in. The program will compile and run. A horrible idea, but effective for dealing with a box of a thousand cards.

Update December 2016 replaced missing picture.

2 comments:

Sya said...

I remember when I was really young, my dad had a whole stash of punch cards that were (obviously) no longer being used. I completely demolished the whole thing with various arts and crafts projects--which probably would horrify a lot of old skool geeks.

Chuck Pergiel said...

I suppose it would be a good idea to save some for a museum, but only some. I imagine billions of these cards were made. I think you found a very good use for something that had otherwise become useless.