Why modernization is hard – Series 8
COBOL programs often generate reports where field formatting is handled using the ‘PICTURE’ clause. This clause allows for complex numeric editing and formatting options in these legacy programs. Most modernization efforts underestimate these complexities. We will highlight a few examples that we come across in customer programs.
The following table shows the results from running COBOL programs, where we recorded the output of various ‘PICTURE’ clauses with examples to illustrate the complexities of editing and formatting.
The currency symbol by default is $ and can be overridden by using COBOL Compiler option ‘CURRENCY’ or coding ‘SPECIAL-NAMES’ in the ‘CONFIGURATION SECTION’ of the COBOL program. An example of overriding currency to be printed as £ is by coding as follows:
This adds complexity to the formatting by printing £ where $ is used in the ‘PICTURE’ clause. The following table gives examples of output with the above CURRENCY SIGN definition.
We have seen more complexities with COBOL programs that generate reports with multiple currencies. In such scenarios ‘SPECIAL-NAMES’ are defined for multiple currencies and a customized ‘PICTURE’ clause symbol is defined. An example of such a definition is shown below.
The following table gives examples of output with COBOL variables defined using the above defined currency signs.
The above complexities are further compounded by the usage of ‘SPECIAL-NAMES’ definition of ‘DECIMAL-POINT IS COMMA’. Many Central European countries switch the usage of Decimal Point and Comma in their amount fields. In these countries decimal separator is ‘comma’ and thousands separator is ‘period’.
There are other formatting aspects where COBOL variables can be defined with clauses viz. ‘BLANK WHEN ZERO’ to suppress printing number 0 when the value of variable is zero, ‘JUSTIFIED RIGHT’ to right-justify a string in a ‘PICTURE’ Clause when default is to ‘left-justify’ strings, ‘SIGN IS LEADING | TRAILING’ to influence whether ‘Sign overpunch’ is on leading or trailing digit when default is ‘trailing’.
Conclusion
Modernization projects often underestimate the complexities of these definitions and formatting aspects used by COBOL legacy programs, leading to delays and failures in achieving functional equivalence. CloudFrame’s modernization toolkit, combined with AI, has extensive coverage to manage these formatting complexities to provide a seamless migration and transparent execution that guarantees functional equivalence.
Recent Comments