This article is more than 1 year old

You had one job... Just two lines of code, and now the customer's Inventory Master File has bitten the biscuit

You're so BASIC

Who, Me? How's August working out for you? Why not take a moment out of your private staycation for another tale of cockuppery from the depths of The Register's Who, Me? vault.

Today's catastrophic coding comes from a reader we will call "Ed", for that is most definitely not his name, and takes us to Canada in the late 1970s.

Ed worked in Technical Support and was at the sharp, pointy end of client calls. The systems he supported were written in Business BASIC and ran on Data General Nova minicomputers.

The Nova first appeared at the end of the 1960s, and gained popularity during the 1970s before fading as the age of the microcomputer swept away the competition. Data General itself endured until the end of the 1990s before being snapped up by EMC.

"All the computers," recalled Ed, "had acoustic couplers so that we could connect remotely and work on their systems."

The team dealt with all manner of calls from customers, usually just fixing programming errors such as field overflows or unexpected user input.

On the day in question, Ed was asked by a customer to perform a relatively simple task. They were about to do their annual inventory and could he do something nifty to zero out the on-hand stock quantities for all their products?

The customer would then go through the list and enter the actual, eyeballed amounts. "This was in the days before barcoding and .CSV imports," Ed explained.

Head exploding

Are you sitting comfortably? Then we'll begin. Hang on, the PDP 11/70 has dropped offline

READ MORE

The task was simple. Ed tracked down the Inventory Master File on the customer's system and found the field that contained the on-hand quantity. He had a program that would do a file dump of any Master File. Normally it would simply read a record, dump the contents, increment the record number and repeat until it reached EOF.

All he needed to do was add a couple of lines: one to set the on-hand quantity to zero and another to write the record back to the file. What could be easier?

A simple two lines.

"That just took a few minutes," said Ed, recalling the confidence with which he bubbled, "after which I called the client and told him it was done.

"I closed the call, marked it as billable and went on with my day."

The client was back on the phone an hour later.

"Hi Ed, it's Bob. We're having a weird problem. When our Order Entry clerk is entering Orders, every product description comes up as 'Brittany Biscuits'. What's going on?"

"With horror," Ed told us, "I realized what I had done...

"When adding the two lines, I had placed the write record statement after the record number increment line, instead of before.

"So now the program read record 1, reset the on-hand count to zero, incremented the record number and wrote the record as record number 2! Ooops.

"Every record in the Inventory Master was now a copy of the first record in the file. Every product description and price were the same.... Brittany Biscuits [it wasn't – the name and business has been changed to protect the guilty].

"The associated index files were unaffected which is why the Order Entry program continued to work.

Unfortunately for biscuit enthusiast Bob, there was no simple fix. The only backup was from the night before, meaning that the customer lost all the work that had been done that morning. Still, at least Ed had remembered to tick the billable box for his efforts in shredding the customer's data.

With a good deal more caution, Ed then re-did his earlier code tweak, but this time got it right.

"From that day on, I have been very careful when making any changes that write data back to the database."

Do you blithely churn out potentially data-destroying code without a care in the world, or is your stomach tied in more knots than a Scouts rope project as you hit 'Execute'? Share your story with an email to Who, Me? ®

More about

More about

More about

TIP US OFF

Send us news


Other stories you might like