Advantage Automated Code Manager for COBOL - The Recode Component

Document ID : KB000055901
Last Modified Date : 17/02/2018
Show Technical Document Details

In our last Advantage VISION E-News newsletter, we published an article on the Assess Component of Advantage Automated Code Manager for COBOL. We discovered that the sample program named Online1.cbl was a good candidate for improvement. Please see technical document TEC321173.

This article is the second in this series. In Advantage Automated Code Manager for COBOL - The Recode Component, you will learn how to use Recode to generate a more structured, and less complex program out of Online1.cbl. The resulting error-free, structured program will be 100% functionally equivalent to the original COBOL program, yet easier to maintain and more consistent with corporate standards. Then use the Assess Component to compare the restructured program against the original program. Here's how:

From the Menu Bar, click on File/New Task/Recode to display the Task Setup Notebook. On the Task Setup Notebook, specify which COBOL Program group and Copybook Folder(s) you want.

Figure 1

Right-click anywhere in the task window to display the short cut menu and select Options.

Figure 2

From the Options notebook, click on the drop down list for COBOL Dialect. Select COBOL 370.

Figure 3

Click 3 times on the right Tab Arrow button Figure 4 to display the rest of the tab header. Then click on the miscellaneous tab header to display the tab page.

Check the box for Print Option Settings. This will record the option settings in the program.

Figure 5

Then click on the CICS/SQL/DLI tab header to display the tab page and select all the CICS Options check boxes as shown.

Figure 6

Right-click in the task window and chose Task Setup from the shortcut menu to return to the Task Setup notebook.

Now save your options definitions and task:
From the File menu select Save Options As. In the Save Options As dialog box, type Online CICS and click Save.
From the File menu select Save Task As. In the Save Task As dialog box, type ONLINE1 and click Save.

Notice that the Options and Task file names now appear on the task window title bar.

Figure 7

From the toolbar, click the Submit button. Figure 8

When the task is finished, the message "Task ONLINE1 has finished execution -0" will appear in the task window status bar. The "0" in the status message is the return code from the execution.

To view the reports for this task, click the Reports button. Figure 9

To view any report, double-click the report name and a window opens displaying the report. Always check the VISION:Recode Information report to make sure the restructuring ran successfully.

View and rename the restructured program. Select View from the toolbar and select Restructured Program....

Figure 10

Click on File on the toolbar and select Save As.... From the Save in: drop down list,

Figure 11

click on the drop down arrow and select the Sample folder and then the COBOL folder.

At the bottom of the screen, change File Name: to Online1r.cbl (I chose the 'r' to identify it as a 'restructured' program). Change Save as Type to All Files.

Figure 12

Click Save.

Open a New Task for Assess. Select the original program (Online1.cbl) and the restructured program (Online1r.cbl) to be assessed.

Figure 13

Use the same Options as you have when running Recode (i.e. COBOL Dialect should be COBOL 370 and Exec Language should be CICS).

Select the BASELINE report.

Figure 14

Be sure to save the task, options and reports.

From the toolbar, click the Submit button. Figure 8

When the task is finished, the message "Task ONLINE1 has finished execution -0" will appear in the task window status bar. The "0" in the status message is the return code from the execution.

To view the reports for this task, click the Reports button. Figure 9

Figure 15

View the Composite Score Report and you can see the statistics on how much the program has been improved.

Figure 16

The Composite Score Report illustrates the composite Scores for each metric. Column 2 represents the total composite score and is determined by applying weights to a selection of metrics and adding those weighted values to compute one score for each program. The advantage of using the composite score for program comparison is that it measures several different metrics and reports them as one single score. A perfect program receives a Composite Score of 100.

We can see at a glance that the original version of the program ONLINE1 has a low composite score of 40; whereas the restructured version of program ONLINE1 shows a composite Score of 82. This is a 42 % improvement! The 'FALL THRU' and the 'GOTO' scores have gone from 0 to 10. Think of this as failing scores improved to perfect scores!

Note that the COMPLEX CODE SCORE for the restructured program is shown as a 7 out of a possible 25. The COMPLEX CODE SCORE is calculated by taking the number of complex paths divided by the total number of paths in the program. A program with a high complex percentage may be difficult to understand, thus making it difficult to implement maintenance changes. As Recode must maintain original functionality, in this case Recode could not eliminate all complex paths in the program.

The metrics that are used in the calculating the Composite scores are shown in the Composite Score Metric Detail report. In the Metric Detail report you can see that the original program ONLINE1 is 67% unstructured, whereas the recoded version of ONLINE1 is 0% unstructured. This means that restructuring made the program COMPLETELY 'structured'. The number of ALTERS, FALL-THRUS & GOTOS FOR NON-EXITS, RECURSIVE PROCEDURES and ACTIVE PROCEDURES are also counted towards the Composite Scores.