Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
rstoll Absent Member.
Absent Member.

I did the Dijkstra algorithm in Acucobol

Just FYI.  Learning about routers, I ran across Dijkstra’s famous algorithm, and in researching it I found that the guy was a real COBOL hater. His words, circa 1975, were something like, “The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.”  So naturally I had to write a program which would execute his algorithm in COBOL!!

I drew on paper an ad hoc network of about 25 interconnected nodes, with a couple stubs, and transcribed the connections and associated costs into working storage.

Took me two solid tries and some debugging, and sure it could be optimized, but was a fun and educational effort. The trickiest part was keeping track of the various subscripts of several tables. The way I did it, one table had two different subscripts in action at the same time.  Expression of satisfaction.

I'm thinking of doing a spanning tree protocol example in COBOL next.

2 Replies
Pass5107 Absent Member.
Absent Member.

RE: I did the Dijkstra algorithm in Acucobol

Long live COBOL. I must confess we use many different languages in our software, and as far as I am concerned COBOL is king. When I asked the net programmer to put his program in debug mode, he said I can't, unless the end user has the tools necessary for me to work with him, this was a lesson well learned, I try to do everything from within COBOL if possible, and so far its been possible.

Great job.
Micro Focus Expert
Micro Focus Expert

RE: I did the Dijkstra algorithm in Acucobol

Dijkstra was a great computer scientist, but he was also a grade-A curmudgeon. It's unfortunate that he's best known for two short, controversial essays: the "Uncomfortable Truths" one you quoted, and "Go To Considered Harmful" (a title which was actually concocted by the CACM editor who printed Dijkstra's letter).

The "Go To" piece and D's subsequent writing on the subject make good points, but too many people just get in pointless arguments over branching as a primitive operation and so forth and never get to the useful aspects of the discussion.

"Uncomfortable Truths", on the other hand, really doesn't say anything useful at all. There are many things to be said about the relative merits of programming languages - though it would be a lot more productive if the people saying them would do some actual methodologically-sound research - but sniping at ones you don't like isn't productive. It's entertaining as a classic religious-war rant, and that's it. (And note D. also hated FORTRAN, BASIC, APL, and most of the other programming languages available at the time.)

All that said, congratulations on successfully implementing Dijkstra's Algorithm. COBOL, whatever its merits and faults, isn't the easiest language for implementing graph algorithms.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.