It's probably safe to say that ChatGPT wasn't created with mainframe operations in mind. Even so, there are some ways that organizations relying on mainframes might benefit from ChatGPT. This is particularly true when it comes to mainframe modernization.
Mainframe modernization takes on many different forms ranging from hardware upgrades to updating applications. Even moving mainframe applications to the cloud could be considered a form of mainframe modernization. So, with that in mind, here are a few ways ChatGPT can help.
One thing ChatGPT can do is convert code running on a mainframe to another language. This is especially helpful for users planning to migrate an application to a PC-based platform or if an application was written in a language that's no longer supported.
The ChatGPT interface makes it seem as though you can only use a single line of text as input. Pressing Enter to go to the next line causes ChatGPT to process what you've already typed. Even so, there's a way to make ChatGPT convert blocks of code.
To show how this works, I found a sample Hello World application written in COBOL, which was the language used to code countless legacy mainframe applications. To make ChatGPT convert COBOL code into something more modern, I copied the code from the website and pasted it into Windows Notepad. From there, I typed a line above the code that said, "Convert this code from COBOL to C#." Figure 1 shows what this looks like.
The next step is to copy everything from the Notepad and paste it into the ChatGPT input field. As shown in Figure 2, using this method enabled me to provide ChatGPT with a multiline input. Upon pressing Enter, ChatGPT sets about converting the code as requested. See the results of this in Figure 3.
One thing to keep in mind when using ChatGPT to generate code is that the results aren't always perfect -- although some code is without error. Even so, the resulting code will typically only require very minor debugging.
Another way to use ChatGPT in mainframe operations is for code optimization. In other words, ChatGPT might be able to rewrite blocks of code so they are smaller and more efficient. For example, you could paste a particular function or subroutine into ChatGPT and ask it to optimize the code.
Code optimization can help an application run more efficiently, thereby enabling it to perform better or to consume fewer system resources, which is important if you're going to migrate it to the cloud. Code optimization also tends to shrink the codebase, which can help reduce the chance of security vulnerabilities.
As you work to modernize your mainframe applications, you might want to use ChatGPT to make your code more legible. Coding best practices have long stipulated that code should contain comments as a way of helping those who must maintain the code in the future. Even so, looking back at Figure 3, you'll notice that the code ChatGPT has generated doesn't include any comments. So why not ask ChatGPT to add comments to your code? See Figure 4 for an example of this.
Checklists and general advice
Although ChatGPT has an enormous potential to help improve the code behind mainframe applications, there are other uses for ChatGPT in mainframe environments. ChatGPT is good at writing checklists or step-by-step instructions and giving general advice. As such, ChatGPT can help guide you through various challenges you might encounter in your mainframe environment. Here are a few examples of some questions you could ask ChatGPT:
- What are the steps involved in migrating an application from an old mainframe to a new mainframe?
- If I move my mainframe application to the cloud, what problems are most likely to occur during the migration?
- How can I improve the performance of an application that's running on my mainframe?
- What can I do to reduce my mainframe hardware and licensing costs?