Boolean Truths

As a bright-eyed and bushy-tailed soon-to-be graduate, Andrew was thrilled to get a job offer before he even graduated. Sure, it involved some new, real-world programming languages that he hadn't worked with, but he was just as confident as his soon-to-be employer that he could pick them right up. And besides, how great would it be to have some solid, real-world technologies like CICS (which probably has something to do with Cisco) and VSAM (Virtual Something Something Something... clearly a cutting-edge technology).

And then the first day hit. Turns out CICS and VSAM were much older than he was, and COBOL was the preferred language of choice. At least I get to work on a mainframe, he told himself. That is, until he learned they were no longer room-sized behemoths staffed by operators wearing cat-eye glasses and bouffant hairdos. It was nothing more than a big ole box called an AS/400.

The main program he was assigned to was truly frightening for a newbie: 250,000+ lines of uncommented, undocumented spaghetti logic that dated from the 60's. The old hands would cheerfully tell newbies that about 70% of the code was never used, but no one took it out since couldn't be sure. As a quick guide, the beast contained over 10,000 GOTO statements. And that was the main overnight account batch program for a major bank.

But the one that got Andrew was the Boolean logic. Now as you may know, COBOL doesn't any have Boolean types; that means most systems had a standard of using a single character string which can be set to "Y" or "N". But not the system he worked on.

Sometimes there was the single character string defined as Y/N (Yes/No). Other places it was a combination of T/F (true/false) and Y/N, leading to logic like this:

IF VALUE-RESET ="Y" OR VALUE-RESET = "T"
MOVE 0 TO VAL
.

Other developers had gone for digits and one/zero. But then there was also the single string F/N. It took Andrew quite a while to wrap his mind around it, despite looking at the scrap of documentation surrounding it