In this session, you use the analysis tools to identify sets of monetary data items.
This tutorial starts the analysis by trying to find the monetary elements in the Order application, in several stages:
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.
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.
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.
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.
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.
This produces a set of data items, as described next.
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:
If your set contains a different number of data items, check that you used exactly the settings listed in Step 4, by double-clicking the tool in the right-hand pane. If you used different settings, go back and rerun the tool with the correct settings.
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.
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.
VAL-P-AND-P-COSTand 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.
VAL-P-AND-P-COSTis still highlighted in the Source View, and then click the Next Usage button several times to see where it's used.
The way it's used in the Procedure Division confirms it is monetary.
TEMP-QTYin the Set View at the top and then click 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.
CURR-DATE-ACCEPTin 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.
OE01in 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.
To name and save the set you have created:
Initial data itemsand 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.
To create a copy of the set so that you can work on it without affecting the original 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.
It remains in the Named Sets window, so you can re-open it at any time.
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:
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.
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.
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:
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:
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.
This imports a set of strings as the search criteria: *date*, *-dd*, *-id*, and so on.
The resulting set contains 95 data items. Scan down the list of data items briefly and confirm that probably none of them is monetary.
The working set now contains 109 data items (204 minus 95). You have now finished deleting false positives from it.
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.
The resulting set contains 66 entries, including both statements and data items.
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.
The resulting set contains 9 data items.
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.