Convoluted code logic can be found in any system or programming language, but modern languages are designed to minimize such issues. For example, the creators of Java opted against direct memory allocation, pointer usage, and direct memory references. This design choice results in less confusing code, fewer bugs, and easier debugging and troubleshooting. Despite being designed with an easy-to-follow, English-like syntax, COBOL presents risks due to its numerous coding options, which can lead to programming errors. For example:
- Logic control transfer statements: a. GO TO statements (especially backward GO TOs to manage application looping)
- Direct Memory area access syntaxes such as: a. Reference modifications
b. NEXT SENTENCE to skip logic
c. PARAGRAPH fall through
d. Combination of all the
b. Using ADDRESS OF syntax to manage set | get address pointers
c. USAGE POINTER datatype
In this blog, I will share experiences from customer modernization journeys where clients were 'Proud of their Legacy Architecture' and discuss how this pride impacts the quality of code during the transformation process.
- One of our customers took great pride in their mainframe's architecture and its historical superiority. While their original design was indeed strong, the modernization journey revealed numerous poor coding practices. The issue wasn't with the initial architecture but with how maintenance practices deteriorated over time. By the time the system reached its 10th generation of programmers, the rigorous standards of the original team had been lost. The modernization team was shocked to discover outdated practices like backward GO TO logic, NEXT SENTENCE usage, and uncontrolled logic flow in the code.
The following illustration depicts a small subsection of 'GO TO' based control flows in one of the customer COBOL programs
- For mainframe teams, using techniques like reference modification, accessing memory locations with pointers, and handling arrays with direct references is commonplace. While these practices are still valued by legacy subject matter experts (SMEs) for their ability to solve complex problems with minimal code, good architecture isn't just about how many lines of code are needed to solve a problem. It's also about how easily future generations of programmers can maintain, debug, and troubleshoot the system. Such practices can complicate understanding and hinder modernization and transformation efforts.
- We have seen COBOL programs intelligently access MVS Control blocks to extract all sorts of information from the operating system using memory pointers and combine that with business logic.
Conclusion
These late discoveries often disrupt ambitious modernization projects. However, CloudFrame Modernization toolkits, combined with AI, can identify and seamlessly transform programs with such complex coding patterns.