2 Replies - 2166 Views - Last Post: 23 November 2016 - 05:29 AM Rate Topic: -----

#1 stevensrmiller  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 11
  • Joined: 29-February 16

When Cards Were Better

Posted 29 June 2016 - 08:49 AM

*
POPULAR

Back in 1979, my college got rid of its IBM-1130 "computer" and replaced it with a VAX-11/780. The 1130 used punched cards as its input, and the only language we could run (other than its assembler) was FORTRAN. The VAX supported Pascal, but none of us knew Pascal the day the VAX went online, so we still programmed in FORTRAN for quite a while. Still, it was a great leap forward because we no longer had to use punched cards. We could use a luxurious device called a VT-100, which had a CRT and (*swoon*) a backspace key.

One day, I was writing a small program in FORTRAN that had to open a file. Here's what my code looked like:

      OPEN(FILE='TEST.DAT', UNIT=6, ERR=9, ACCESS='SEQUENTIAL', RECL=98,
     1     STATUS='SCRATCH')


That lonely "1" starting the second line was how you told FORTRAN that it was a continuation of the line above. That code ran fine. Later, I no longer needed to open the file as a "scratch" file, so I just (oh joy!) backspaced over that bit, leaving my code like this:

      OPEN(FILE='TEST.DAT', UNIT=6, ERR=9, ACCESS='SEQUENTIAL', RECL=98
     1     )


That ran fine too. Next, I was ready to use my program on real data, not the test data I had been using. So, I changed the file's name in the open statement:

      OPEN(FILE='STATUS.DAT', UNIT=6, ERR=9, ACCESS='SEQUENTIAL', RECL=98
     1     )


The program stopped working. It compiled fine, but generated inscrutable run-time errors. I thought, "My test data and my real data must have some important difference." So, in an effort to confirm that it was the data, not the code, I copied my TEST.DAT file to STATUS.DAT and ran again. No luck! Amazingly, when I compiled and ran the program to open TEST.DAT, it ran perfectly. But, when I compiled and ran the program to open STATUS.DAT, it utterly failed, even when both files contained the exact same data!

I worked on this for hours until someone looked over my shoulder at the VT-100's screen and said, "Your line's too long."

See, in those days, a FORTRAN program made specific uses of certain sets of columns in your punched card. Column 1 had to be blank, "C," or a digit. Blank meant it was just a line of code, "C" meant it was a comment line, and a digit meant it was a line with a label. Labels could be any integer up to five digits long, using columns 1 through 5.

Column 6 could be blank or any character. Blank meant it was just a line of code. A character meant it was a continuation of the line above (which I was using in my own program).

Columns 7 through 72 were for your code statements.

Columns 73 through 80 were for "sequence" numbers. These were optional, but you could have the keypunch machine (or any of several other frightening electromechanical contraptions) punch numerically ordered integers into those columns. This was a great help if you had a big program and ever (God forbid) dropped your deck and had it shuffle itself. After such a catastrophe, you could take your unsorted deck to a collating machine and, after several passes, your deck would emerge sorted into the order defined by the sequence numbers in those last eight columns on your cards.

Thing is, none of us ever used sequence numbers. For our big decks (oh, did I mention that we "stored" our programs on those cards, as our 1130's disks were 500kb each, and only one was available for student use?), we just put them in a card box, took a yardstick and a magic marker, and drew a long diagonal line across their top edges. If (well, when) you dropped your deck, you could just stack the cards back up and visually find the ones out of order by looking for deviations in the edges of that thick black diagonal line. (Yes, this really worked.)

So, what had gone wrong with my code? Nothing, except that the new file name lengthened the first of my two virtual "cards" (remember, I'm using the exotic VT-100 here) by two columns. That "98" used to end in column 71. With the new file name, it ended in column 73. The result was a correct FORTRAN statement that opened a file with a record length of 9, a sequence number of 8 applied to the first virtual card, and a proper right-parenthesis (to close the OPEN statement) on the next line. At run-time, the program opened the file, but treated every set of nine characters as a separate record. That explained everything.

This may suprise you, but when that guy looked at my screen and said, "Your line's too long," my reaction was not one of pure gratitude.

Regardless, this may be the only experience with a bug that I have ever had, where I think it would not have stumped me if I had actually still been punching cards, as the cards were well labeled with lines showing what each set of columns was dedicated to. The fabulous VT-100 had no such rulers to alert me.

Maybe not the worst code I've ever seen (or even written), but today, over three decades later, it still gives me nightmares, so here it is.

Is This A Good Question/Topic? 6
  • +

Replies To: When Cards Were Better

#2 oldSwede  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 4
  • View blog
  • Posts: 464
  • Joined: 08-January 16

Re: When Cards Were Better

Posted 23 November 2016 - 02:51 AM

That is one great story! Makes me think of some of my first programs that were stored on paper tape with holes punched in to it. I think my first game resulted in a ˝ pound roll of paper tape. And when the tape broke and you had to fix it so it would still work in the reader... Those were the times. :wheelchair:
Was This Post Helpful? 1
  • +
  • -

#3 stevensrmiller  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 11
  • Joined: 29-February 16

Re: When Cards Were Better

Posted 23 November 2016 - 05:29 AM

View PostoldSwede, on 23 November 2016 - 02:51 AM, said:

That is one great story! Makes me think of some of my first programs that were stored on paper tape with holes punched in to it. I think my first game resulted in a ˝ pound roll of paper tape. And when the tape broke and you had to fix it so it would still work in the reader... Those were the times. :wheelchair:/>/>

Ah, yes. Before my college days, I programmed in high school on an HP-2000, using an ASR-33 teletypewriter with a paper tape punch and reader. A ripped tape could bring the mightiest of us down to sobbing. But, you could also punch readable character shapes into those tapes. And, if you punched the same message into three or four tapes, then repunched the right pseudo-random patterns into those same tapes, the individual tapes would look like noise, while stacking all the tapes on top of each other left only the original holes that formed the message open all the way through the stack.

Let today's cryptographers figure that one out!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1