Hand Coded Sorting

One of my earliest jobs was that of a programmer at Nevada National Bank in Reno, Nevada. I wrote programs in BASIC on a new IBM PC running DOS 1.0 with two floppy drives. The file system in DOS 1.0 had no subdirectories, only files.

This IBM PC also had a Corvus brand 5Mb hard drive that was about the size of the box that a pair of cowboy boots would come in. IBM PCs running DOS 1.0 did not support hard drives, but it worked because the hard drive had its own controller that DOS thought was a huge floppy drive. Still, no subdirectories.

I wrote and updated numerous programs performing various functions, including branch banking work measurement. Little did I know that this experience would soon prove valuable.

In a financial recession, the Bank conducted a reduction-in-force, and I found myself out of a job in December in a weak job market.

I was also an active member of Mensa and joined a local group on Monday evenings at a hotel bar. One of the regulars there found me a contract job at LifeTouch Portrait Studios’ Western U.S. processing center. This would prove to be key to a great career.

LifeTouch Portrait Studios hired me as a contractor to write a piecework payroll system for their photo printing factory. This was a tall order, but having taken a class the year before in Warnier-Orr structured program design analysis, I was well equipped to write the entire system. I worked in an office with the company’s IBM PC and got to work on the project.

The system I designed and created consisted of a data entry program, a data correction program, and a report program. I designed a database that consisted of a series of flat files as there were no relational database management systems available for IBM PCs. This was not an obstacle for me, as I already had a pretty good background in data design, and this piecework payroll system was not all that complicated.

I ran into a significant problem when I was writing the report program. Data entry records could be entered in any sequence, but the report output had to be in a particular sequence. There were thousands of records, and the DOS built-in sort program was no help: I had to write a sorting routine.

There was no Internet, nor even UUNet, at this time, so I hoofed over to the Nevada-Reno library and checked out a book on computer algorithms that contained pseudocode on various sort algorithms. After some reading, I elected to use the Shell-Mentzer algorithm, as it was purported to be pretty fast. I coded it up, tested it, and it seemed to function correctly.

One problem: the sort took 45 minutes to run. What to do!

I went down to Egghead Computers and picked up a copy of Microsoft BASIC Compliler, which cost me $50 if I recall. I compiled the report program and ran it again – this time, the sort took 1-2 minutes.

The reason that the compiled program sort ran faster is the elimination of the BASIC runtime system interpreting each instruction in the program, compounded by the overhead of reading and writing to a floppy disc.

This experience, including the design, programming, and working to ensure the customer understood how to use the system, would prove invaluable later the same year, when I was hired by Bally Systems as a software engineer. There, I initially wrote and updated BASIC-Plus programs on DEC PDP-11 computers for our customers, who were the largest casinos in the world. Later in this job, I learned Unix and C, and led a team of software engineers to rewrite one of our company’s applications in C on Unix with relational databases. This proved to be my breakout job that led to even bigger and better positions in the years to come.

About peterhgregory

Published author of over forty books on security and technology, including Solaris Security, CISSP Guide to Security Essentials, and IT Disaster Recovery Planning for Dummies.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment