Recently I wrote a post about OpenAI's "Codex", which translates natural English language into ready-to-use program code in any number of different programming languages. Codex is currently in beta release and is still in its infant stages, but eventually OpenAI hopes that it can be used to interact with existing program code simply by issuing spoken instructions. That would open up a lot of possibilities - including one that caught my attention over the weekend.
There are still millions of lines of COBOL code out there in the business world, running thousands of major software systems. Converting all those programs to a more modern platform would be a huge task. However, I came across a video this past Saturday about using Codex to automatically translate between Python and COBOL ("Codex translates COBOL to Python", by Mark Ryan, Oct. 3, 2021, https://www.youtube.com/watch?v=uTIk2fifO50). As somebody who has done considerable programming in COBOL over the years, I was really interested in whether Codex could manage to actually translate COBOL code into Python program code (and vice versa).
To test the ability to convert back and forth between the two languages, Mark went to the Codex "playground", entered a very basic "hello world" program in Python and had Codex generate the equivalent code in COBOL. Running Codex's generated code in OpenCOBOL's IDE showed that Codex can indeed handle very simple COBOL programs. However, Codex failed to convert a slightly more complex Python program into valid COBOL code - but it did manage to successfully convert the COBOL version of that program into a valid Python program.
That's a really intriguing result, considering the level of interest in translating a lot of COBOL legacy code into Python or some other language that's in common use today. It's probably still a way off into the future, but Codex could eventually turn out to be the answer to modernizing a lot of those COBOL programs that are still running some of our most important business systems.