Besides contributing at @TheDailyWTF, I write DevDisasters for Visual Studio Magazine, and involved in various side projects including child rearing and marriage.

During water cooler conversation with his co-workers, whenever Dennis mentioned that he was responsible for supporting the Month End Closing system, reaction varied from a wide-eyed, agape look to a snide chuckle.

The Month End Closing system had a reputation throughout the department of being an ancient and legacy application that management had refused to upgrade over the years. Some of the comments put its true age at somewhere in the late 80’s early 90’s era which had earned it nicknames like “Ol’ Bertha” or “Methuselah” but most simply called it the “Legacy Dung Heap”.

Month-End Madness

Lady luck was not on Dennis's side that one fateful morning of his first month-end.

"OHMIGOSH! I JUST RAN MONTH END AND GOT AN ERROR CODE 40" panted the frantic caller, "IT...THE SYSTEM WON'T LET ME, OR ANYONE IN THE OFFICE, DO ANYTHING...CAN YOU GET US AN UNLOCK KEY???"

Dennis reassured the user that everything would be fine and to hang on literally for a minute while he investigated. While it was compeletely owned in-house, the Month End system harbored a funny quirk left over from when it was originally written by an outside software firm.

When the system hit certain conditions, usually catastrophic data problems, everything would be frozen until a support person could provide the "Hex Key of the Day." A secret value derived from the Error Code, Current Date, and software license key. Dennis opened the web form to generate the daily Hex Key but was surprised at the result:

CANNOT GENERATE HEX KEY FOR ERROR CODE - PLEASE INFORM TIER 1 SUPPORT TO REFERENCE G-A24456

This bothered Dennis greatly as he was in the Tier 1 support group.

WTF is a G-A24456?

After re-assuring the customer that the solution was still only another minute away, Dennis knew that he would have to think fast. Desperate, he simultaneously searched the source code repository, documentation portal, and the department's shared network drive hoping that G-A24456 was unique enough to find a result and ended up hitting pay dirt.

In the source, G-A24456 was a function called from the section of the code responsible for handling month-end receipts and was shocked to find out what an Error 40 really stood for.

The error was a division by zero error.

Dennis quickly scoffed at the programmer who couldn't add a quick logic check to see if the number being used as the divisor was in fact zero. Then, Dennis looked at the source again.

There on the screen was a FORCED division by zero to stop program execution. No message, no exiting of a loop, nothing that would allow the user to self corrects and retry:

x=1/0; ## (DIVZEROHALT) Unprocessed receipts exist, instruct ## user to run the receipt register. Generate Hex Key ## using Error Code 99 (MISC) to unlock system. ## SNK 10/05/92

After picking his chin up off the floor, Dennis gave the hex key, instructed the user to process any outstanding receipts to get everything moving again, and immediately booked an appointment with his supervisor.

Leftover Secrets

In his meeting, Dennis relayed his findings – the forced division by zero, the developer note, and for good measure, a rant on the use of the Hex Key in general. Why not just show a pop-up window saying “You didn’t process the damned receipts – go do that and come back”? he argued.

"Close the door, Dennis. I have something to talk with you about."

Dennis's supervisor explained that whole idea of the hex keys were originally created long ago by the original developers with a dual purpose. The first was to force the user to stop everything if the system had some major mess-up, and second, to provide a steady stream of income for their support desk in the form of long-term support contracts.

“The way that our corporation works is that the number of hours we bill to our users for support directly impacts our funding for the next year,” explained Dennis’s supervisor,

"Why do you think that we are able to attend various conferences, have free coffee service, or enjoy our delightfully ergonomic work stations? All this is a result of our department's ability to bill for support."

He continued, "Frankly, if we remove all of the DIVZEROHALT statements and the concept of hex keys in general, we'll all probably have to be laid off!"

Dennis nodded to the supervisor's point while pondering his next move - go downstairs for some of that great free coffee or return to his desk or start work on polishing up his resume.