next up previous
Next: Conclusions Up: Two examples Previous: Grammar development for a

Separating coordination and computation in COBOL

A typical renovation problem is to migrate transaction systems from a mainframe to a networked PC environment. Such systems are strongly tied to mainframes by the use of embedded languages like CICS that deal with transaction monitors and the coordination of data. In order to migrate to a client/server architecture, it is therefore necessary to remove this embedded CICS code. Once that is done, the code needs to be made more maintainable by removing all traces of the platform migration from the source code.

In the example that we will now discuss, a German company (SES GmbH) had already eliminated some dangerous CICS code, and we have constructed a migration tool to separate coordination from computation so that all CICS code could be removed. One of the main problems was to eliminate jump instructions from the code. Figure 4 shows a strongly simplified version of the ``spaghetti'' code of the original program. The code fragment is representative of the overall quality of the code that can be found on mainframes. The first GO ... DEPENDING ... is actually a case statement, and contains four cases that are all GOs. So in fact in this small fragment we have 8 jump instructions.

Using a restructuring method based on a systolic algorithm we can remove the GOs in about 25 steps in such a way that the coordination and computation are separated, and the logic of the program becomes more clear. In Figure 5 the final output is shown. As can be seen, the code has been changed dramatically. Superfluous code is gone and coordination is separated from computation.

Paragraph HV-050 provides the coordination part of the program and resembles a main program in C. The EVALUATE ... END-EVALUATE statement is the result of migrating the original GO ... DEPENDING ... statement; the original four cases could be collapsed into two cases. In the HAUPTVERARB-SUBROUTINES section, we can see that two computations are present. They are only reachable via the coordination part, since the STOP RUN blocks other access. This is comparable to a preamble in say Pascal where procedures are declared.

An original program and all intermediate steps that are carried out to remove the jump instructions and to separate computations from coordination are available on Internet.[*]We discuss this kind of restructuring in more detail in [45].


next up previous
Next: Conclusions Up: Two examples Previous: Grammar development for a
Paul Klint 2001-06-10