Friday, December 29, 2006

.

Line printers and FORTRAN programs

IBM 1403 line printerFor another story about times at The Nerd, I have to explain a bit about line printers and carriage control codes.

In contrast to page printers in common use today (such as laser printers, which fuse toner to paper one page at a time), the printers we used in the 1970s were line printers. They used spinning chains (literally, metal chains) of letters and inked ribbons, and they printed a line at a time. The IBM 1403, pictured, printed 132-character lines at a speed of 10 lines per second, onto fan-folded, sprocket-fed paper (the edge strips containing the sprocket holes were perforated and could be torn off, giving a marginally less geeky look to the result). They only printed upper-case letters, numbers, and common punctuation characters (keeping the size of the print chains down). There were no graphics.[1]

With page printers, each page is laid out by the computer program and is printed as a complete page. But with line printers, each line would be printed sequentially... so how would you start a new page? You could count lines, if you knew how many lines fit on a page, and then print a suitable number of blank lines, but that seems like a poor way to do it. A better way was to use carriage control codes.

The program could tell the printer to interpret the first character of each line as a control code. It would then send up to 133 characters per line, and the control code would tell the printer how to move vertically as it printed that line. A blank was the normal “print and advance one line” code; “+” caused no advance, allowing multiple lines to be overstruck; “0” advanced an extra line for double-spacing; and “1” skipped to the top of the next page [I've corrected the “+” and “0”; thanks, Jim]. There were others, but those were the ones we took advantage of most often.

To make things easier on the programmers, the normal manner of running computer jobs put the printer into control-code mode. Of course, that meant that when one wrote one's program, in, say, FORTRAN (as most of the student programs were), one had to be sure to put a blank (or other appropriate code) at the beginning of each line. Most beginners neglected that, at least the first time.

So, imagine a program that computes numbers and prints one number per line.

Imagine that the program computes a couple of hundred numbers.

And imagine that all the numbers turn out to be between 1000 and 1999.

You see where I'm going with this, don't you?

It's interesting to see how rapidly paper can be spewed from an IBM 1403 printer, when it's printing only one three-character line per page. To make it worse, we couldn't even cancel these jobs because despite the many pages, the actual number of characters printed is small, and it would all be in the printer's memory buffer by the time we saw the problem.
 


[1] One could actually do rudimentary “graphics” using only the characters available on the print chain and different degrees of overstriking to get darker and lighter areas. We couldn't do any real graphics, but we had posters of the Mona Lisa and of the moon, and a few others, made by printing many pages of this stuff — each page formed a section of the poster — and taping the pages together appropriately. The repeated overstriking made horrific noises on the printer and tended to tie up the printer for a while, making one unpopular with the computer operators if one did this during busy times.

5 comments:

Maggie said...

I used to work in the computer labs at UMD when I was a student, and I can still hear the printers' whine as they printed line after line. It was part of the background noise of the lab. There were always the annoying kids (like you, I guess ;-) who sat there and printed out pictures during the last week of the semester when everyone else was trying to do their work.

I also remember our mainframe was so slow that at the end of the semester, we'd often get timed out of our connection while our programs compiled. LOL. Now this semester, my students are so used to doing everything on their own computers, that they complain if they have to do something in the lab! Heaven forbid they sit in the lab and do a project! I remember driving all the way home from school once, realizing once I got home what the bug was in my program, and driving all the way back so I could fix it!

Barry Leiba said...

Thanks for the comments, Maggie. I started a long response comment, but then decided to turn it into another blog post instead, for the next time I decide to take us back 30 years.

Maggie said...

Well, I'll look forward to stepping into the way-back machine again, although my experiences aren't quite 30 years old. We just had archaic equipment, apparently. ;-) You ol' dinosaur, you.

I was the first lab assistant in the first Mac lab on campus, and they had no hard drives and only one disk drive. The big fun was having students save their "MacWrite" files. They'd have to switch the two disks fifty times* to save a one-page paper.

*Probably an exaggeration. But not by much.

Jim Fenton said...

I remember 0 (zero) as double space and + as overstrike. Not that it matters. Some printers (not sure about the 1403) contained a loop of paper tape that allowed the form (and "vertical tab") length to be specified differently for different forms, like checks.

Tearing off the sprocket holes definitely made the result only marginally (heh) less geeky. If the wide format and fanfold of the paper didn't give you away, the horizontal stripes (typically green and white, 3 lines per bar) printed on the paper usually did.

Barry Leiba said...

Thanks, Jim. You always seem to have a slightly better memory than I do on these things, and you're right about the control codes; I've corrected the main entry.

Yes, the 1403 had a control tape, which needed to be changed when different (vertical) sized paper was loaded, or when one wanted different forms control. There were a couple of printers at the main computer center that they did that on — we never changed the tape (except to replace it when it broke) at the remote job entry station.