PreviousExploring and Documenting Send Us CommentsNext

Chapter 8: Scripts, Editing and the Shell

In this session, you use the Split Screen Editor to edit the source of your application. You use various other features of Revolve, including scripts and the REQL shell.


Please see the Tutorials Map to check that you have run all necessary previous sessions.


8.1 Overview

Having used Revolve to examine your application, and having decided what source changes are needed, you can of course use any editor to edit your source. If you have Mainframe Express you might like to use that.

You can if you wish use the Split Screen Editor in Revolve.

In this session you identify an unused paragraph in the project's source code, and see how to edit or delete it.

8.2 Preparation

This session uses the project you created in the chapter Creating a Project.

  1. If you have closed Revolve, open it as before.

  2. Open the Sample project by selecting it from the "recently used files" list at the bottom of the Project menu.

8.3 Using a Script

To identify unused paragraphs you use a script:

  1. Click Tools > Scripts.

  2. Double-click the Unused Analysis folder.

    The scripts shown generate various reports on the source code.

  3. Select Unused Paragraphs and click Run.

  4. Select BATCH2.CBL in the Choose Components dialog box and click OK.

    The script creates and displays a text report. It shows there are several unused paragraphs in BATCH2.CBL.

  5. 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, the status bar at the bottom of the Report shows it as selected.

  6. Click View Source Code .

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

  7. Click in the editing window.

    This deselects C100-CONVERT-SALES-DATE's, so you can see it is highlighted in yellow. Yellow indicates unnecessary source code identified by a script. If you were to open this source file in another tool or browser, these highlights would be shown.



    Figure 8-1: Result of Unused Paragraph Report in the Split Screen Editor

    If the source is not highlighted in this way, click Options on the Split Screen Editor's tool bar, then check Show highlights and click OK.

8.4 Editing the File

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

    The Split Screen Editor returns to the source for C100-CONVERT-SALES-DATE, and the paragraph is selected.

  2. Click Cut to Clipboard.

    The unused paragraph has been removed.

  3. Close the Report window.

  4. Click No in the Save File dialog.

    We have not saved the updated source file - we will now look at another way of making this edit.

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

  6. Double-click the folder for COBOL files.

  7. Select BATCH2.CBL and 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.

  8. Click Find on the Split Screen Editor's tool bar.

    The Search and Replace dialog box appears.

  9. Type C100-CONVERT-SALES-DATE in the Find Text field and 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 dialog box, or leave it alone in the source because it is not causing problems.

8.5 Using the REQL Shell

If you do want to leave the unused paragraphs, you may want to remove the highlighting:

  1. Click Utilities > Options.

  2. Ensure the check box for REQL Shell on the User tab is checked, and click OK.

  3. Click Shell on the Tools menu.

    The Shell tool is invoked. This is a command line interface that you can use to type Revolve Query Language (REQL) commands, typically for batch analysis and administrative tasks. Further information on REQL is contained in the Revolve User's Guide.

  4. Type
    clearHighlights("all");

    in the Shell and press Enter.

    This removes highlighting from all highlighted sources.

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

8.5.1 Making Global Edits

You can also make multiple changes in a single operation. For example, you can change the names of data items or paragraphs throughout the source file or even throughout the application.

To replace the string "GAME" with "ACTIVITY" in data-names:

  1. Click Project > Manager.

  2. Double-click the cobol files folder.

  3. Select BATCH1.CBL and click View Source Code.

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



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

  4. Click Find.

    The Search and Replace dialog box opens.

  5. Type WORKING-STORAGE in Find Text.

    Ensure that Proper Name is not checked.

  6. Click OK.

    WORKING-STORAGE is selected in the editor.

  7. Click Find again.

  8. Type DEFAULT-GAME-ID in Find Text.

  9. Check the Replace With check box.

    The Replace With field is enabled.

  10. Type DEFAULT-ACTIVITY-ID in Replace With .

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

  12. In the Origin area, select System to search and replace across the entire project. The dialog box should now look like Figure 8-2.



    Figure 8-3: Search and Replace Dialog

  13. 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.

  14. 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.

  15. Click Windows > Close All Windows.

  16. Answer No to All to the messages asking if you want to save the updated files.

8.6 Summary

In this session you:

8.7 Before Continuing

If you want to take a break before going on to the next session, you can close the project; or you can close Revolve with or without closing the project.

Return to the Tutorials Map and choose which session to go on to next.


Comments on the books?

Click Send Us Comments.


Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousExploring and Documenting Send Us CommentsNext