Chapter 2: Finding Sets of Monetary Points of Interest

In this session, you use the analysis tools to identify sets of monetary data items.

2.1 Overview

This tutorial starts the analysis by trying to find the monetary elements in the Order application, in several stages:

  1. Initially we load the settings for the country you choose. These settings represent typical, general guideline values for applications written in that country, and can be used directly in the tutorial. However, you will probably need to tailor them before using them with your own applications.

  2. We then look through the copyfiles and programs for any data items that meet the default search criteria. We set the bounds fairly wide, because your program might contain complex arithmetic and might need to preserve accuracy, so we allow for large numbers and up to four decimal places. As you might expect, this sort of search locates large number of data items, which are used for all sorts of things. However, this is necessary to make sure we don't miss any with monetary implications, and EuroSmart contains powerful facilities to help you isolate and remove those items that don't hold monetary data.

  3. Now we try to work out the types of item that can't possibly have anything to do with money, because eventually you will need to examine each item individually, and we want to reduce the set of possibles. Again we do this with a broad brush, so that you don't waste time looking at things like counters, subscripts and other items that just help the flow of the program.

  4. The final set we identify contains monetary constants. We want to find constants that might be used as a threshold for allocating postage and package costs or to enforce credit limits. We search for data items that are initialized to a value and for statements which use constants with monetary data items. All of these might need attention and might need decisions from business analysts, so it's key that such constants are identified as early as possible.

In this tutorial you use the Analysis Tools on the Euro menu to produce various sets of potential points of interest. The tutorial uses the following tools:

This tutorial takes about 30 minutes.

2.2 Preparation

This section explains how to set up the analysis tools with the necessary options and defaults, so that the results you get match those of the tutorial.

  1. If you are continuing immediately from the last tutorial, go straight to step 2.

    Otherwise, restart EuroSmart if it is not running, and open the Order project by selecting it from the recent files list at the bottom of the Project menu. For details of how to build the Order project, see the chapter Finding Points of Interest in the Revolve Enterprise Edition Getting Started.

  2. Click Analysis Tools on the Euro menu.

  3. If the metering wizard pops up, don't worry. The Order project is already metered; you won't be charged for this project. However, you need to point to the metering control file that confirms that the Order project has been metered. Follow the wizard's instructions and when asked for the metering control file, point to the directory Samples\Enterprise\Meter, which contains the relevant metering control file, factory.bdb.

  4. Click Options Options on Analysis Tools.

  5. On the Set View Options tab, make sure that all the options are checked, so that your system matches the one for the tutorials:

  6. On the Analysis Tools Optionstab, check Edit settings before running tool. If you don't check this, when you subsequently run the analysis tools, they run immediately without allowing you to see and change the settings.

  7. On the Scope tab, make sure that Universal scope is clicked, so that all the programs in the application are searched by the analysis tools. Click OK.

  8. Check that the status line at the bottom of the Analysis Tools window shows Settings: Defaults\United Kingdom. This means that the analysis tools will use the default settings appropriate for the United Kingdom.

    If Defaults\United Kingdom is not shown, set it as follows:

If you break off from the tutorials, you might change these options and settings as you work and experiment. If you do change them and then want to continue with the tutorials, you need to reset the options and settings back to the ones needed for the tutorials.

2.3 Searching for Data Items by Format

The first search is for data items with PICTURE formats that could represent monetary values. We set the bounds fairly wide, from four digits, which includes digits both before and after the decimal point, right up to the largest number that COBOL allows, 18 digits. We disallow numbers less than four digits, since these are unlikely to be monetary values. We also allow from two decimal places down to none. In countries such as Italy or Belgium you might specify fewer decimal places, and for some applications that demand high accuracy, you might specify more.

  1. On Analysis Tools, click Format of data items and click to see the help describing this tool.

  2. Double click Format of data items to run the tool. This displays the default settings for the United Kingdom.

  3. Ensure the settings are the following, so that they are appropriate for the Order application:

  4. You can click at the top right of the dialog and then click any field for an explanation of that field.

  5. Click OK.

This produces a set of data items, as described next.

2.4 Exploring the Set and its Contents

The set you just produced is displayed in a Set View, as shown in Figure 2-1.

Figure 2-1: Set View

In the Set View:

2.5 Examining the Data Items in the Set

Now you start getting to know the sample source code, looking through the data items in the set and finding which data items aren't monetary and so need to be removed from the set. These items for removal are sometimes referred to as false positives.

  1. In the Set View, look at the data item VAL-P-AND-P-COST.

    If you can't see it, you can scroll to it quickly. Click the Sort Ascending button to get the list into alphabetical order, then click in the left-hand pane and type V to get to the first item beginning with V.

    This item's name certainly implies it holds a monetary value. However, you might want to look at it in the context of the source code to confirm that it really is monetary.

  2. Click VAL-P-AND-P-COST and then click the View Source Code button .

    This splits the Set View into two panes with the set at the top and the source file containing the data item's definition at the bottom. If necessary, drag the bottom edge of the Source View and/or the horizontal divider between the two views, so that you can see more source code.

    Notice that the definition of VAL-P-AND-P-COST sets an initial value of 17.50, which looks like a monetary value. Later we will capture a set of all such monetary constants.

  3. Make sure that VAL-P-AND-P-COST is still highlighted in the Source View, and then click the Next Usage button Next Usage several times to see where it's used.

    The way it's used in the Procedure Division confirms it is monetary.

  4. Now click TEMP-QTY in the Set View at the top and then click Next Usage several times to see how this item is used.

    From its name and the names of the data items it is used with, you can see this is not a monetary item. Later we will remove it, along with other items whose names imply that they aren't monetary items.

  5. Now examine CURR-DATE-ACCEPT in the same way.

    Since this data item is used to hold the date, it is definitely not monetary and not of interest. In the following sections you search this set to find sets of data items that for various reasons are clearly not monetary, and remove them from this set.

  6. Now examine the data items starting OE01 in the same way.

    These data items all correspond to BMS fields. Their data definitions are automatically generated from the BMS screen map and so have names ending in L, I, O corresponding to how the data items are used. Some of these data items might refer to monetary fields on a BMS screen, and might need modification. Once again, there is a tool to identify BMS-related data items.

  7. Close the source view, by clicking {Source View} again at the top of the Set View.

2.6 Naming and Saving a Set

To name and save the set you have created:

  1. Click Options Options on the Set View.

  2. In the Name field, type Initial data items and click OK.

    This saves the set in the project directory. Its filename is the name you specified, with the extension .set. Its name now appears in its title bar.

  3. Click Enterprise > Named Sets, and you can see the set listed there. If the Named Sets window is not visible, you might need to scroll down to it and drag it up to just below the Analysis Tools window. If you can't see all of the name, drag the header bar divider for the Name column a little to the right.

2.7 Creating a Working Copy

To create a copy of the set so that you can work on it without affecting the original set:

  1. Click in the "Initial data items" set so that the title bar is highlighted.

  2. If necessary, drag the set to one side, so that you can see the whole Analysis Tools window.

  3. Point to Whole Set in the toolbar of the "Initial data items" set.

  4. Drag the icon and point to the name Copy or Create set in the Analysis Tools window.
  5. When the cursor changes to to indicate a set operation, drop the set onto Copy or Create set.

    The new set is now ready for you to use as a working set, so that you can refine it, gradually removing the unwanted non-monetary items.

  6. Tidy up by closing the "Initial data items" set.

    It remains in the Named Sets window, so you can re-open it at any time.

  7. Drag the working set to the top of the Revolve window, and to the right of the Analysis Tools window.

2.8 Subtracting Data Items Used in Non-monetary Ways

Many of the data items in the working set are irrelevant because they aren't used to process money, but rather are used to help the flow of the program. There is a tool for identifying these data items. It finds, for example, data items controlling PERFORM VARYING statements, and data items to do with dates.

To search the working set for these sorts of data items and remove them from the working set:

  1. Point to Whole Set in the toolbar of the working set and drag it onto Use of data items in the Analysis Tools window.

    If you run an analysis tool by double-clicking it, it searches the source files of the application as defined on the Scope tab of Analysis Tools Options. If you run the tool by dragging a set onto it, it further limits the search to justthat set.

    On the dialog box, look at the check boxes to see the uses of data items that this tool searches for.

  2. Make sure all the check boxes are checked and click OK.

    The resulting set contains 46 data items. Notice that these data items are genuinely unwanted, since they represent dates, lengths, error codes, and so on.

  3. Now remove the data items in the new set from the working set. Start to drag Whole Set from the new set, then hover over the working set without releasing the mouse button.

  4. When the hover menu appears, select Subtract and drop the new set onto the working set. Click Yes on the warning message to confirm that you want to subtract the set.

    The working set now contains 204 data items (250 minus 46). Its history in the right pane, which records the tools and set operations used to create it, is now as follows:

  5. Tidy up by closing the set created by Use of data items. Click No when asked whether to save the set.

2.9 Subtracting Data Items with Non-monetary Names

Another set of data items that aren't of interest are those whose names imply they are unlikely to contain monetary amounts. There is a tool to find these items. Since any application has its own naming conventions, you need to specify the kind of names to look for.

To search the working set for data items with these names and remove them from the working set:

  1. Drag Whole Set in the working set and drop it onto Names of data items in the Analysis Tools window.

  2. Clear the existing defaults, by clicking Clear.

    We have supplied a list of names for the Order demo, so that you can import this list and run the tool quickly. In the real world you would develop your own list of names as you work on an application and get to know it. You can keep your list in a separate file and pass it to colleagues working on similar or related source files. This not only saves them time but also ensures consistency when any of you rerun the tool.

  3. Click Import and specify the file Criteria.txt, which is in \samples\enterprise\orderapp\other.

    This imports a set of strings as the search criteria: *date*, *-dd*, *-id*, and so on.

  4. Click OK.

    The resulting set contains 95 data items. Scan down the list of data items briefly and confirm that probably none of them is monetary.

  5. Subtract this non-monetary set from the working set. This time, instead of dragging the set and waiting for the hover menu to appear, hold down Alt while you drag the non-monetary set onto the working set.

    The working set now contains 109 data items (204 minus 95). You have now finished deleting false positives from it.

  6. Name and save the working set as "Potential monetary data items" using Options as before.

  7. Tidy up by deleting the set created by Names of data items. As before, don't save it.

2.10 Finding Monetary Constants

You now look for monetary constants, and the statements and data items associated with them. Monetary constants might represent a fixed amount of money that is added to a customer's bill - for example, a handling or shipping charge. The value of a constant might change substantially if, for example, the company starts shipping very large, heavy items when it has never done so previously.

It is important to identify these monetary constants in the Data Division and the Procedure Division early. Although changing these amounts is easy, determining which need to be changed is typically done by the business analysts and not the IT department. Identifying these constants at an early stage will help the decision process, especially as this information might raise questions or issues that the business analysts had not previously contemplated.

  1. Drag the working set - now called "Potential monetary data items" - onto Constants used with data items and statements.

  2. Ensure that Exclude multiplication by -1 is checked, so that this search excludes irrelevant constants; also ensure that the constant "ZERO" is shown in the list.

  3. Click OK to run the tool.

    The resulting set contains 66 entries, including both statements and data items.

  4. Examine the contents of the set in the context of the source code, to confirm that they genuinely involve constants in some form. To do this:

    Click the first entry in the set and click View Source Code. Then press down arrow to show the source for each set entry in turn.

    Notice that the entries are either data items defined with constant values, or statements that use those data items, or statements that contain constant values used with the data items in the "Potential monetary data items" set.

  5. Name and save the new set as "Monetary constants".

  6. For demonstration purposes, separate out the data items from the set "Monetary constants", by dragging the set ontoFilter set and selecting only the two Data items choices in the Worksheet tab column in the list. These two items are listed as "cobol_var" and "cobol_condition_c88".

    The resulting set contains 9 data items.

  7. Close the set of data items without saving, since you don't need it. However, on other occasions you might need to separate a mixed set into its constituents, so that you can process the separate sets through further analysis tools.

  8. Tidy up by closing the "Monetary constants" set and the "Potential monetary data items". You have already saved both of these.

2.11 Before Continuing

The sets created in this tutorial contain data items and statements that might be monetary and might need modifying. The process used in this tutorial is a good first step, and identifies the most likely points of interest.

However, this process does not produce 100% accurate results. It has identified some unwanted items, and has missed some items of interest.

The GA product is expected to contain tools to enable you to rectify these discrepancies, by removing false positives and assigning categories to potential monetary items for use by the Euro estimation engines.

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