PreviousAssigning Scope with Subprojects Analyzing Data ImpactsNext

Chapter 7: Editing Source Code

Revolve helps you improve the quality of your project's source code by employing workbench capabilities to the facilitation of code modification. Revolve determines which statements, paragraphs, variables, and copybooks are unused in the system and alerts you to their status, in the event that the unused components should be extracted from the system. Revolve also provides a variety of vantage points from which code analysis can be observed. This feature ensures that your code modification efforts are necessary and correct.


You need to have read the chapter Start Here for the Tutorials! and worked through the first session, Creating and Loading Projects, before you do this session.

In this session, we assume that you have created Sample.prj.


7.1 Overview

Revolve determines which statements, paragraphs, variables, and copybooks are unused in the system and alerts you to their status, in the event that the unused components should be extracted from the system. Revolve also provides a variety of vantage points from which code analysis can be observed. This feature ensures that your code modification efforts are necessary and correct.

In this session you will identify an unused paragraph in the project's source code and learn how to remove it's source. You will also become familiar with the Split Screen Editor and how to use it to edit source.

7.2 Preparation

You will apply the procedures in this session to the sample project created in Creating and Loading Projects. If Revolve and sample.prj are closed, open them like before.

7.3 Sample Session

In this session you:

7.3.1 Making Singular Changes to Source Code

To do this:

  1. From the Tools menu, select Scripts.

  2. Double-click the Unused Analysis folder.

    The expanded folder displays dynamic scripts that generate specific source code reports.

  3. Select Unused Paragraphs

  4. Click Run.

  5. Select BATCH2.CBL in the Choose Components dialog box.

  6. Click OK.

    A progress bar displays the advancement of the script. A text report containing the results of the script is also displayed.

  7. Scroll the Report window upwards until the information for the program BATCH2.CBL is visible.

    The report indicates that there is are several unused paragraphs in BATCH2.CBL.

  8. Click on the report line that reads:
    C100-CONVERT-SALES-DATE

    The line for C100-CONVERT... is not "selected" in a color as in other Revolve windows. However, notice that the status bar at the bottom of the Report shows that it is the selected element.

  9. Click View Source Code .

    The Split Screen Editor opens to show the contents of BATCH2.CBL with paragraph C100-CONVERT-SALES-DATE selected.

  10. Click the mouse in the editing window.

    Notice C100-CONVERT-SALES-DATE's source is highlighted in yellow. When yellow appears in the editor, it indicates unneeded source code was identified with a script.

  11. If the source is not highlighted click Highlight on the Split Screen Editor's tool bar.

  12. Scroll down in the Split Screen Editor.

    Notice all of the unused paragraphs that were identified with the script are highlighted in yellow. Highlighting is applied to the source for these elements across the project. If you were to open this source file in another tool or browser, these highlights would be shown.

  13. Click C100-CONVERT-SALES-DATE in the Report window again.

    The Split Screen Editor returns to the source for C100-CONVERT-SALES-DATE. Since this paragraph is not needed, all of its contents are selected and can be removed.

  14. With the mouse button positioned at the beginning of the paragraph, click and drag to select the source code for C100-CONVERT-SALES-DATE.

  15. Click Cut to Clipboard.

    The source for the unused paragraph has been removed.

  16. Click the Report window's .

  17. Click No in the Save File dialog.

  18. Open the Project Manager by clicking Project Manager at the bottom of the Desktop.

  19. Double click the folder for cobol files.

  20. Select BATCH2.CBL.
  21. Click View Source Code.

    The source for BATCH2.CBL is displayed in the Split Screen Editor. Let's find our unused paragraph named C100-CONVERT-SALES-DATE.

  22. Click Text Search/Replace on the Split Screen Editor's tool bar.

    The Search and Replace interface is invoked.

  23. Type C100-CONVERT-SALES-DATE in the Find Text field.



    Figure 7-1: Search and Replace for the Unused Paragraph

  24. Click Ok.

    The unused paragraph is shown still highlighted in yellow. You can modify the paragraph, replace it with something else by using the Search and Replace interface, or leave it alone in the source because it is not causing problems. If you do want to leave the unused paragraphs, you may want to remove highlights to avoid confusion.

  25. Click Utilities > Options... .

  26. Click the User tab.

  27. Check the check box for REQL Shell.

  28. Click Ok.

  29. Click Shell on the Tools menu.

    The Shell tool is invoked. This is a command line interface that employs REQL for some analysis and administrative tasks.

  30. Type
    clear all;
    in the Shell.

    This removes highlighting from all highlighted source.

  31. Hit Return.

    Notice the highlights have been removed from the source code of the unused paragraphs. To re highlight the paragraphs, run the script that was executed at the beginning of this section.

  32. Close all open windows by clicking the Window menu and selecting Close All Windows.

    You have just learned how to use Revolve's scripts to identify areas in your project that should be improved. You also worked with the Split Screen Editor, the Highlight feature, and the Shell tool.

7.3.2 Implementing Changes Globally

In addition to facilitating individual changes, Revolve also combines multiple changes into a single operation. Names of variables and paragraphs can be replaced throughout an entire application. Consistency and standards are improved or enforced by the normalization of names. In this session let's replace the string "GAME" with "ACTIVITY" in eligible variables.

To do this:

  1. From the Project menu, select Manager.

    The Project Manager is opened in the Desktop.

  2. Double-click cobol files folder.

    The COBOL files loaded in the project are displayed. You may need to resize the window to see the entire list.

  3. Select BATCH1.CBL.

  4. Click View Source Code.

    The source code of BATCH1.CBL is displayed and selected in the Split Screen Editor.


    Figure 7-2: Source code for BATCH1.CBL in the Split Screen Editor

  5. Click Text Search/Replace.

    The Search and Replace interface is invoked.

  6. Type WORKING-STORAGE in the Find Text field.

    Be sure that Proper Name is not checked.

  7. Click OK.

    WORKING-STORAGE is selected in the editor.

  8. Click Text Search/Replace again.

  9. Type DEFAULT-GAME-ID in the Find Text: field.

  10. Check the Replace With check box.

    The Replace With field is enabled.

  11. Type DEFAULT-ACTIVITY-ID in the Replace With field.

  12. Check Proper Name and Adjust Columns in the Options area. Variables should be displayed in the drop down list box.

  13. In the Origin area, select System to search and replace across the entire project. Notice the following figure.


    Figure 7-3: Search and Replace Dialog

  14. Click OK.

    A Proper Name Replace prompt asks, "Replace this occurrence?" The occurrence is highlighted in the Split Screen Editor window.

    The first highlighted item is the definition. The subsequent items are usages.

  15. Click Yes to All to replace DEFAULT-GAME-ID with DEFAULT-ACTIVITY-ID.

    You are notified that the one definition was replaced and that all four subsequent usages were also replaced. The columns should all be aligned because of step 12.

  16. To clean the desktop before moving on to the next chapter, choose Close All Windows from the Windows menu.
  17. When the Revolve dialog appears, inquiring if you want to save changes, answer No to All to preserve sample.prj for the next person.

7.3.3 Before Continuing

You can close Revolve, if you want to stop for now. The project that you have created and loaded is automatically saved.

You can continue with the next tutorial later, by simply reopening the project.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
PreviousAssigning Scope with Subprojects Analyzing Data ImpactsNext