Chapter 4: Using Analysis Tools

This chapter describes the tools available from the Tools menu and how they can help you in your tasks.

Introduction

Analysis tools provide powerful insights into how your source code applications function. They are accessed from the Tools menu and are named according to their functionality. The following tools are available for you to use during your analysis tasks:

Shell

The Shell tool is enabled on the User tab and is accessible from the Tools menu. It gives you an interactive command line interface for using REQL with Revolve, which enables you to perform specific administrative and analysis operations on the Revolve database. The REQL language is described in detail in the chapter Introduction to the REQL Language.

Metrics

The Metrics tool calculates four statistical measures of complexity:

To change from one mode to another, use Options within the Metrics window. The Metrics tool is set to Halstead by default. To change the default mode, click the Metrics tab to change the settings that are used when the Metrics tool starts its analysis. After you select a new mode, the analysis is automatically performed when you click OK.

The Halstead metric mode uses four numbers to calculate the estimated length of each program. These numbers are the total number of operator occurrences (N1), the total number of operand occurrences (N2), the number of distinct operators (n1), and the number of distinct operands (n2). With these numbers, Halstead estimates the program length to be:

N=N1 + N2

The volume to be:

V=N log2 (n1 + n2)

The McCabe metric mode calculates the cyclomatic, extended, and essential complexity of each paragraph and program. These numbers represent the number of logical paths through the source code.

The McClure metric mode calculates complexity for each paragraph and program as the number of conditionals plus the number of unique operands used in the conditionals.

The Statistics metrics mode displays the number of lines and statements in each paragraph and program.

Function Point Analysis

Use the Function Point Analysis tool to measure the complexity of your project.

The implementation of Function Point Analysis is based on the International Function Point Users Group's (IFPUG's) 4.1 function point analysis definition.

Note: We recommend that you select Project > Complete before opening the Function Point Analysis tool, to provide any missing information.

Complexity Factors

The FPA Options enable you to define weighting factors that adjust the parameters of the Function Point Analysis. A numerical value is determined based on the designated weight of each function where 0 represents no influence and 5 represents strong influence. You can change the defaults for this dialog by clicking Utilities > Tools/ Diagrams Options and the Function Point Analysis tab. Using Options within the Function Point Analysis window changes the settings only for that particular session.

Function Point Analysis (FPA) first identifies and organizes the system's business functions into five groups:

  1. External inputs
  2. External outputs
  3. External inquiries
  4. Internal logical files (ILF)
  5. External interface files (EIF)

Note: FPA classifies screen accesses as either inputs or outputs. Data files are classified as ILF or EIF. The distinction is made in that ILFs are written to and EIFs are not.

Then each business function is classified and weighted by its level of complexity (low, average, or high). Finally, the numbers are totalled to establish the complexity of your project. The higher the total is the more complex the project is. The evaluation process can be viewed in the Function Point Analysis window.

File Types

Classifications opens the File Types dialog, to allow you to specifically identify file types. By selecting an item and clicking the specific button, elements can be designated as inquiries, inputs, outputs, ILF, or EIF. If an element is unused it can be tagged Unused.

Annotation

The Annotation tool allows persistent documents or notes to be created that contain references to elements of source code as well as user-defined information about those elements. Annotations are useful:

Using annotations is an excellent way to document source code changes as well as performing project management tasks. Use the Annotation tool to create, manage, research, or delete annotations. Each annotation includes a title, description, status, and list of related elements. These documents or notes will exist within a Revolve project until they are explicitly deleted. The Annotation tool is accessed from the Tools menu or from the speed menu.

The Annotation tool locates annotations based on certain parameters defined in the Edit Annotation dialog. Use the pull down list box to select the parameter that is to be used to find a specific annotation. Enter the name or naming convention in the Match edit field and click Match. Annotations that match the criteria are displayed in the information window.

When you add elements to an annotation, you do not have to add them in the order they occur in the source. To organize your annotations, use the Sort function. It orders connected elements in two ways.

Sorting elements according to the order they were added preserves any existing process used to create the annotation. Sorting by location in the source file enables you to order connected elements by their occurrence in the source code. This is especially useful when you want to organize elements that were randomly added to the annotation. After clicking Sort, click Refresh , and then expand the connected elements folder to view the changes.

Editing Annotations

The Edit Annotation dialog is invoked with Edit Annotation .

The following information is available for each annotation:

Field: Definition:
Title:

Names the annotation.

Date:

Indicates the date the annotation was created. This field can not be changed.

By:

Displays the user name assigned to the person who created the annotation. The default user name is taken from the value specified in the User Name field of the Utilities > Options > User tab.

Status:

Monitors the status of annotations that are used for source code changes.

To:

Identifies the intended recipient.

Description:

Describes the annotation. Descriptions should be limited to 8,000 bytes (8K).

Associated Elements:

Lists the other elements that are associated with this annotation. This is a concise way of associating related elements to a single annotation. Elements for this list can be selected by using tools, views, and information browsers. To add all currently highlighted elements, click Add Highlighted. To delete an element, select the element in the Associated Elements list and press Remove.

Element Description:

Describes selected elements. Each element in the Associated Elements list can have an optional description associated with it. As the current selection in the Associated Element list is changed, the Element Description is updated with the corresponding description.

To save changes to the annotation, click OK. To cancel changes, click Cancel.

Adding Information to Annotations

Information can be added to annotations from the Annotation tool or with Capture Results. If an annotation is currently being edited in an Edit Annotation window, the elements are added to that annotation, otherwise the Add element to annotation window is displayed. This enables you to create a new annotation or lookup an existing one.

Annotations in Shareable Projects

Annotations in shareable projects have two classifications:

When you create an annotation in a shareable project it is Public by default. To move it to Private:

  1. Open the shared project.
  2. Click Tools > Annotation.
  3. Locate the annotation.
  4. With the annotation selected, click Move Annotation to Private .

To make it Public again, click Move Annotation to Public . If these buttons are not displayed in the Annotation tool, close and restart Revolve. A single annotation cannot be public and private simultaneously.

Public annotations are stored by default in the same directory as the project file (.prj). You can change this location by clicking Utilities > Options and the Project tab. Note that this directory must be accessible to all users of a project. Private annotations are stored according to the setting of the Private Annotation Directories setting on the Directories tab in Utilities > Options. We recommend that the Private and Public annotation directories be different.

Scripts

The Scripts tool enables you to automate specific tasks in Revolve. Scripts are organized according to their general purpose in project analysis and operation. They are categorized as follows:

Expand each folder to view the scripts it contains. To run a script, select it and click Run. Often specific project components must be selected for a script to execute its designed function. The Choose Components dialog enables you to assign a scope to the script, applying the scripting procedure to selected project items.

Cross Reference Reports

Cross Reference Batch Files with Records and Copybooks

Shows records used in I-O against batch files and the copybooks containing the record layouts. Records moved to or from I-O records are included in the record list.

Cross Reference CICS Datasets with Records and Copybooks

Shows records used in I-O for CICS datasets and copybooks containing the record layouts. Records to which I-O records are moved are included in the record list for a dataset.

Cross Reference Files by PL/I Procedure

Shows files accessed by their procedure.

Cross Reference Files by Program

Shows files accessed by programs. Records displayed for program/file are records READ INTO or WRITTEN - REWRITTEN FROM, as well as the data record defined in the File Definition (FD).

Cross Reference PL/I Procedures by Files Accessed

Shows procedures accessing files by file.

Cross Reference Programs by Files Accessed

Shows programs accessing files by file.

List data files written to by JCL job

Shows data files in your project that are written to by JCL job executed programs.

Data Rationalization

Homonym Analysis

Finds variables whose names are the same but whose PIC clauses define different types or sizes.

Parsing Problems

List Errors

Reports on parser-generated errors in user-specified project components.

List Errors and Warnings

Reports on parser-generated errors and warnings in user-specified project components.

List Errors, Warnings, and Notices

Returns all discrepancies discovered during project parsing.

List Files Not Found During Parsing

Reports on parser-generated file-not-found warnings in user-specified project components. File-not-found warnings are most likely copybooks or proclibs that have not been added to the project before parsing.

List Notices

Reports on the notices that occur during the parsing process. Notices are the least severe of the parser-generated problems.

List Syntax Warnings

Reports on parser-generated syntax warnings in user-specified project components.

List Warnings

Reports on parser-generated Warnings in user-specified project components.

Show Duplicate Definitions by type

Shows all modules by type that have been added to the Project Manager where duplicate names exist in multiple directories. This script is designed to show invalid conditions that exist in the source code, so that problems can be resolved.

Show load modules without source and what invokes them

Shows programs in your project that do not contain source code and other load modules that are affected. Results are organized according to the source-less programs and the affected programs.

Project Management

The Project Management scripts are provided as templates that you can customize to automate some of your common administrative tasks. Select a script and click View Source Code to view its source. These templates are working scripts that you can actually execute if your directory structure adheres to that used in the script, and if the sample source code that was included in the installation is located in samples\sampleapp.

Customize these scripts according to your project needs. You can review the source and replace existing parameters with some of your project's parameters. For example, in the Template for creating a new project by explicitly adding sources, substitute the existing paths with your system paths and file names. Once you are satisfied with the settings, save the script. Then click Compile . Once the script has compiled it's ready to be Run . For information on language constructs and functions specific to project administration, see Automating Project Management.

Template for creating a new project by explicitly adding sources

Customize this script to create a new project and add components. Substitute existing settings with your system parameters.

Template for creating a new project using search paths

Customize this script to set up search directories for your project, where Revolve loads components of specified types from specified directories. These search directories are referenced for subsequent Makes and updates. Substitute existing settings with your system and project parameters.

Template for performing a batch update on a project

Customize this script to automate project Makes . Substitute existing settings with your project parameters.

Record Analysis

Copybook List Sorted by Name

Opens a Choose dialog that displays all the copybooks referenced in the project. Select a copybook or copybooks (Ctrl key and left mouse button) and click OK. The script describes all variables referenced in the copybook(s) and their attributes.

If nothing is returned for a selected copybook, check to see if the copybook is loaded properly. An easy way to find problem files is with the Parsing Problems scripts.

Group I-O records by size

Reports on I-O Records. Records are 01-level input/output records.

Group Secondary (non-I-O) Records by Size

Reports on non-I-O records. Records cannot be input or output (exclude all records defined in Comm Area, FD, and Linkage sections) and must be 01 group level data elements.

I-O Record Grouping

Groups I-O records by size/name.

Secondary Record Grouping

Groups secondary (non-I-O) records by size/name.

Standards Checking

Hard-Coded Literals by Program

Reports on usage of hard-coded literals by program.

Indentation Checking

Identifies program source that violates the following indentation rule:

MOVE Statements that Truncate Data Elements

Reports on MOVE statements that result in truncation. Truncation is a result of data elements being moved from a field of a certain size to one of smaller size.

Multiple MFS files with same FMT name

Returns MFS screen files that have duplicate FMT names.

Multiple copybook files with same name

Returns a list of copybooks in the project with duplicate names.

Nested IF Statements

Determines greatest number levels of nested IF statements within the selected programs. Reports on and highlights all IF statements exceeding user specified maximum.

Redefines Length Mismatches

Reports on variable redefines, for which the redefining and redefined variables are of different lengths.

Report COBOL members with mismatched PROGRAM-IDs

Generates a report of all COBOL programs whose program IDs differ from their member names. The discrepancy between program IDs and their member names may cause problems in other scripts, resulting in programs being out of order and duplicated in output reports. This script exposes such occurrences.

Variable Names Exceeding Threshold

Reports on Variable Names whose length exceeds a user defined maximum within the selected programs.

Unused Analysis

Copybooks with no Referenced Variables

Reports on copybooks included in programs whose variable definitions are not referenced or whose procedural logic is not executed.

Unused Paragraphs

Reports on paragraphs whose statements are not executed.

Unused Procedural Logic

Reports on the unused procedural logic within the program selected in the Choose dialog.

Unused Program Variables

Provides information about variables that are not explicitly used in the loaded project. Please note that some returned fields may not be removed from the project because they are part of redefines, structure definitions, or copybook members that cannot be modified.

Utilities

Copy source files to drive/directory

Invokes a Choose Components dialog where you need to specify the components whose source files you want to copy to another location. Click OK. In the Prompt dialog, enter the path to the drive or directory where the files should be copied.

Count lines Logical & Physical

Counts logical and physical line numbers for all project modules. It will generate four columns:

Column Indicates
Module Name: Specifies the project module's name.
Logical: Refers to the total number of lines in a module, including imported elements (copybooks, procs, et cetera.).
Physical: Refers to the actual line count in the module. Imported elements (copybooks, procs, et cetera.) are not included.
Imports: Lists the numbers of lines brought into the module through imported elements (copybooks, procs, et cetera.).

Count total number of lines to be metered

Counts files and lines that need to be metered, so you can calculate the size of the usage counter to purchase. It will generate a list of program files, copybooks and includes, and tell you both how many files could be metered and how many files and lines need to be metered. See the chapter Metering Lines of Code for more information.

Generate a script to rebuild the import translations

Allows you to utilize the import translations of one project in another one that requires the same translations. The default name and location of the script that is generated is c:\buildimp.rqs. When you use the script Rebuild Import Translations it will ask you for the compiled version of this file (.rqc).

Generate a script to build this project from scratch

Creates a script that is used to rebuild the active project (including Complete Project and Copybook Translation information).

Generate a list of files in directories which are not in project

Creates a list of source files which are not used in the project, but which have been found in directories contained in the project.

Open screens used by the component w selected

Opens Screen views associated with the selected item. To select a project component, right-click on it in a Revolve information window and choose Select from the speed menu. The selected component's name is displayed at the bottom of the Revolve desktop.

Print the text content of the selected item

If the selected item is a paragraph, printing the "text content" of a paragraph will print the whole paragraph.

Remove Load Modules and PSBs only referenced in IMS GEN

If your IMS GEN has load modules and PDBs that are not referenced elsewhere, this script will remove them.

Remove load modules in CSD report that are not referenced

If your CSD report has load modules that are not referenced, this script will remove them.

HTML Reports

Batch Files Cross-Referenced by Records

Displays the filename, record name and location of batch files, in an RSP Viewer. The RSP Viewer is embedded in a child window, and offers a split-screen source view.

Files Not Found

Displays any parser-generated file-not-found warnings in an RSP Viewer. The RSP Viewer is embedded in a child window, and offers a split-screen source view. File-not-found warnings are most likely to be copybooks or proclibs that have not been added to the project before parsing.

List Warnings

Displays any parser-generated Warnings in user-specified project components in an RSP Viewer. The RSP Viewer is embedded in a child window, and offers a split-screen source view.

Project Inventory XML Document

Displays the files in your project, by type, with any files they import, in an RSP Viewer. The RSP Viewer is embedded in a child window, and offers a split-screen source view.

Impact Analysis

Impacts occur when data elements refer or relate to one another in a project through moves, redefines, conditionals, arithmetic operations, group relations, parameter passing, copybooks, references to files, and references to screens. When one item is changed in an application, it can affect other items, causing inconsistencies and even system failure.

The threat of data impacts poses a major problem when you consider the task of system maintenance and specifically making source code modifications. For example, if you modify just one data item, it might impact many different source components in many different areas of your system. To guarantee source code integrity, the Impact Analysis features enable you to identify all locations in your system where specific data elements have impacts. Once you've located the impacts, you can modify source code accordingly to alleviate impact problems that may arise when you apply modifications to your actual system. The benefits of using Impact Analysis are:

We recommend that you select Project > Complete before opening the Impact Analysis tool, to provide Revolve with any missing information.

Defining Starting Points

The first step in impact analysis is to define a list of data elements that might be impacted or cause impacts. This list of impact candidates is used as the starting point for the impact trace. A starting point can be any data element that is scheduled to be or has been modified or edited. Also, a starting point must be located in a loaded, up-to-date project file.

The Impact Analysis tool locates and loads starting points according to the naming criteria you specify in the Match edit field. Specify an element's exact name or use wildcards to define naming patterns for many elements that use similar naming conventions.

Starting points must be classified as variables, BMS or MFS fields, or data files. The Match edit bar contains a pull down list box that enables you to specify the type of item to find. For example, to load all project variables whose names begin with WS, select Variable from the pull-down list box, enter WS* into the Match edit field, and click Match. The Impact Analysis information window fills with all project variables with names like WS-TABLES and WS-KEY.

When you click the Match button, Impact Analysis searches the project database and identifies all source components that comply with your name and type criteria. Matched components are displayed in the information window. These are your starting points for impact tracing. The total number of starting points is displayed on the Match edit bar. Impact Analysis for the Assembler Extension uses variables as starting points and traces through direct variable manipulations in MOVE statements.

Refining Impact Candidate List

When you have a list of starting points that are considered impact candidates, you can edit, remove, or exclude items based on your analysis needs.

Setting Impact Tracing Options

In a large, complicated project, it is essential that you be able to control the direction and flow of the impact trace. Otherwise, you would be sifting through unneeded and unimportant impact trace information. The Tracing tab on the Impact Analysis Options dialog enables you to define the parameters for tracing impacts from your starting points through the project. There are four categories of options: Impact Through, Prune, Logical Levels to Expand, and Enable Code Flow Analysis.

Impact Through

The Impact Through options control which circumstances are considered to cause the impact of one variable on another. The options enable you to configure the impact trace to return specific information on impacts occurring in certain project modules. You direct the path of impact tracing through source code components, like conditions, literals, arithmetics, copybooks, data files and executables. With this control you can trace impacts through points of interest as well as known problem areas in your source code.

All options are checked by default, except Children.

In the sections below, all Impact Through options code examples are located in your samples\impact directory, in the files prog1.cbl and prog2.cbl. Each example is preceded by a corresponding named label. For example, 01-IT-CONDITIONS for the Conditions option.

The Impact Through options are:

Prune

There are some situations in which the Impact Analysis tool returns information that probably does not represent a true impact. The Prune options are built-in rules to remove these items. Normally, you will want to prune these items from the impact analysis output. For this reason, the default state for all these options is checked. This means that the built-in pruning rules will apply. If, in unusual circumstances, you do want to include any of these items, you can suppress pruning by unchecking one or more of these options.

In the sections below, all Prune options code examples are located in your samples\impact directory, in the files PROG1.CBL and PROG2.CBL. Each example is preceded by a corresponding named label. For example, 08-PR-SUSPECTLITERAL for the Suspect Literal option.

The Prune options are:

Logical Levels to Expand

The Logical Levels to Expand option specifies the maximum number of logical levels to expand from a starting point. This feature is useful when you want to step through an impact one logical level at a time.

Entering "0" expands through all logical levels.

Enable Code Flow Analysis

The Enable Code Flow Analysis option determines whether Impact Analysis considers only data movement in a program or if it considers the sequence of statements. By default, this option is unchecked and only data movement is considered. This can occasionally lead to unexpected results. For example, if your starting point is the variable A and your program contains the following statements:

MOVE B TO C
MOVE A TO B

then the output will include A, B, and C. Even though the MOVE B to C statement occurs before the MOVE A to B statement, C is included because the sequence of statements is not considered. This is fine for purposes such as field expansion but not for tracing data flow. If you check the Enable Code Flow Analysis option, Impact Analysis will consider the order of program statements and C will not be included in the output. However, if the above sequence is included in a loop, Code Flow Analysis correctly recognizes that the first MOVE can be executed after the second. C will then be included in the output.

If you check the Enable Code Flow Analysis option, you must select a variable usage as opposed to the variable's definition as a starting point for Code Flow tracing.

Note: Running Impact Analysis with Code Flow Analysis enabled can be much slower than running it with this option unchecked.

Performing the Impact Trace

After you are satisfied with your impact candidates and tracing options you're ready to perform the impact trace. Impact tracing begins at each starting point in the source code and traces through each element encountered. Along the way impacts with other project elements are determined, identified, and returned in the results.

To initiate impact tracing, click Impact Tracing . By default, the Impact Analysis tool displays all results by name. You can change the display of impact information. See Display Options.

Examining the Results

Once you have performed an impact trace, expand the displayed folders to view the chain of events that led to each impact. The trace chain of events are displayed as leaves . Each leaf details a step in the data movement leading up to the impact of an item with the impact candidate.

During impact tracing the Impact Analysis tool analyzes data for all project entities that are affected when the variable, BMS field, or MFS field is modified. Impacts are categorized into the following types:

Display Options

The Impact Analysis tool gives you various modes in which to view the results of an impact trace. Click Options... and click the Display tab. The options provided enable you to have complete control over the display of the impact trace results. It is important to pay attention to the starting points that you use to identify impacts. Your results can be displayed according to those starting points or by the items that are impacted.

Saving Impact Analysis Results

The Impact Analysis tool enables you to save the results of an impact trace. The impact analysis is saved to a location that you define in the Save dialog that is invoked when you click Save Impact Analysis . The file is given an .ia extension. To open the impact analysis file later, click Load Impact Analysis .

Advanced Text Search

Advanced text search allows you to specify the exact text, or text pattern, you want to search for, in files and directories which you also specify. You can refine this by specifying text, files and directories to be ignored in your search.

The six tabs on the Advanced Text Search dialog allow you to enter your precise requirements. They are:

Directory Search Patterns

In this tab, you can specify multiple project directories, and subdirectories if required, to include in the scope of your search. By default, this tab is populated with directories containing source files used in the current project.

Directory Search Pattern tab

Figure 4-1: Directory Search Pattern tab

Directory Exclusion Patterns

This works in the same way as the Directory Search Patterns, except this specifies directories and subdirectories to be ignored in your search.

Directory Exclusion Patterns tab

Figure 4-2: Directory Exclusion Patterns tab

File Search Patterns

In this tab, you can specify the filename extensions to include in the scope of your search. You do this by selecting from a file types list, supported extensions list, or by adding your own filename patterns. The following pattern matching is used:

File Search Patterns tab

Figure 4-3: File Search Patterns tab

File Exclusion Patterns

This works in the same way as the File Search Patterns, except this specifies filename extensions to be ignored in your search.

File Exclusion Patterns tab

Figure 4-4: File Exclusion Patterns tab

Text Pattern Inclusions

In this tab, you can specify multiple text patterns to include in the scope of your search. You can use the wildcard character (*) to indicate one or more characters, or the question mark (?) to specify one character, and select whether to make your search case sensitive. You can save your text pattern as a .mpt file, or load an existing text pattern.

Text Pattern Inclusions tab

Figure 4-5: Text Pattern Inclusions tab

Text Pattern Exclusions

This works in the same way as the Text Pattern Inclusion, except this specifies patterns to be ignored in your search. It works by first searching for the patterns you specified in the Text Pattern Inclusion tab, and then removes from the results any patterns specified in this tab.

Text Pattern Exclusions tab

Figure 4-6: Text Pattern Exclusions tab

Viewing the Results

The Advanced Text Search Viewer displays all files with matches based on your requirements. Click the plus sign (+) in front of the filename to display the specific lines of code containing your text pattern match. Results are shown in bold italics. You can use the Split Screen Viewer to examine the results more closely. You can view an item that is found by the Advanced Text Search in a tool or browser only if that item has been added to the current project.

Source View

The Source view creates a logical view showing all the integrated files that comprise a module. For example, for a COBOL program, the copybooks and include files are interleaved in the main source file. As a further example, for JCL, a logical view that integrates all the proclibs with the main job is shown. The Source view displays the source code as it would appear in its source file format. The overview window runs along the left side of the view and provides a representation of the source file. The selected item's location appears as a horizontal bar in the overview window. Highlighted items will also be displayed in their appropriate color in the overview window.

Open Source

When the Source view is invoked from the Tools menu, an Open Source dialog appears. To find a specific source file, enter the file name into the Match edit box and click Match. Or use the list to find and select multiple files for display in the view. The Select All !button selects all of the items in the scroll-able list and opens Source views for each file.


Copyright © 2006 Micro Focus (IP) Ltd. All rights reserved.