Previous Loading a Project into the Database Populating the Worksheet Next

Chapter 6: Finding Sets of Monetary Points of Interest

This chapter contains the second in a set of five tutorials, which together give a tour of EuroSmart. This tutorial shows how to use the analysis tools to identify sets of monetary data items.

6.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 can save you time and trouble, as they are based on the local knowledge of our people resident in that country. These settings specify the types of data item you typically use, useful literals to look for and so on, and you don't have to type anything unless you want to change the settings.

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

6.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 the 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.

  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 EuroSmart\Revolve\Sample\Euro, which contains the relevant metering control file, factory.bdb.

  4. Click Options Options on Analysis Tools.

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

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

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

6.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 that 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.

6.4 Exploring the Set and its Contents

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



Figure 6-1: Set View

In the Set View:

6.5 Examining the Data Items in the Set

The set you have just created has a large number of data items, since the initial search was so broad, and inevitably some of the items aren't monetary.

In this section, you start getting to know the sample source code, scanning the data items and discovering that some data items aren't monetary and aren't of interest and so need to be removed from the set later. These items for removal are sometimes referred to as negative or false points of interest, whereas items that are definitely needed are known as positive or genuine points of interest.

  1. Look at the first data item in the set, VAL-P-AND-P-COST. If this is not the first item, click any of the data items in the left pane and press V to go to it quickly. From the name of the data item, you can assume that the item holds a monetary value. However, you might want to examine the data item in the context of the source code to confirm that the data item is genuinely monetary.

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

    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, so that you can see more source code. You can also drag the horizontal divider between the set view and the source view at any time.

  3. In the source view at the bottom, notice that the highlighted line is the definition of VAL-P-AND-P-COST. Notice that 92:12 shows in the status bar at the bottom of source view. This indicates that the cursor is at line number 92 and column number 12.

    Notice that the definition of VAL-P-AND-P-COST sets an initial value of 17.50, which looks like a monetary value. It also looks like a hard-coded constant in one currency that might need converting to euros. Later we will capture a set of all such monetary constants.

  4. Make sure that VAL-P-AND-P-COST is still highlighted and then click Next Usage Next Usage several times to confirm that item is indeed monetary.

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

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

  6. 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. Later, we will find a whole set of data items based on how they are used, and remove that set since their usage implies that they are not monetary.

  7. Click Sort Ascending, to sort the data items into alphabetical order.

  8. Now examine WS-AREA-LENG in the same way. You can press W and down arrow to go to the data item quickly.

    This data item is used to hold the length of record and to pass the length in an EXEC CICS statement, and so it is definitely not monetary and not of interest. Later, this data item will be part of the same set as CURR-DATE-ACCEPT, together with other data items whose usage implies they are not monetary.

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

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

6.6 Naming and Saving a Set

In this section, you name the set, with its 121 items, so that you can refer back to it easily. You also save it in case you inadvertently delete it or the PC crashes or hangs.

  1. Click Options Options on the Set View.

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

    Notice that the name you gave appears in the title bar of the set.

    Note: The set is now saved to disk. Its filename is the name you specified and has the extension .set. The set is saved in the project directory Projects\Order.

  3. Click Named Sets on the Euro menu, 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.

  4. Create a copy of the set so that you can work on it without affecting the original set. To do this:

    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

  5. Tidy up by closing the "Initial data items" set, as we don't need it any more.

    Notice that the "Initial data items" set remains in the Named Sets window, so that you can recall it at any time, but it isn't cluttering up the screen for now.

  6. Drag the working set to the top of the EuroSmart window, and to the right of the Analysis Tools window.

6.7 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 are used to help the flow of the program. There is a tool for identifying these data items and it finds, among others, data items controlling PERFORM VARYING statements, and data items to do with dates. Having identified the non-monetary data items, we can remove them from the set so that we start to refine the set more precisely.

This section searches the working set for these sort of data items and then removes them from the working set.

  1. Take the working set that you just copied and extract those data items that are used in ways that imply they aren't monetary.

    To do this, point to Whole Set in the working set and drag it onto Use of data items in the Analysis Tools window.

  2. Review the check boxes to get an understanding of the uses of data items that this tool searches for. Make sure all the check boxes are checked and click OK.

    The resulting set contains 17 data items. Notice that these data items are genuinely unwanted, since they represent dates, a length and so on.

  3. Remove the data items in the new set from the working set. To do this:

    The working set contains 104 data items (121 minus 17).

  4. Review the working set's history in the right pane, which now records the tools and set operations used to create the set, as follows:

  5. Tidy up by deleting the set of data items containing just 17 items. To do this, click in the the top right corner of the set view and click No when asked whether to save the set.

6.8 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. However, since each program has its own naming conventions, you need to know the names to look for before running the tool. For example, the Order project has data items with "weight" and "quantity" in their names.

We have supplied a list of these names for the Order project, so that you can import this list and run the tool quickly. In the real world you would develop your own list or lists of names, while you work on a program and get to know it. You can keep your list in a separate file and this enables you to pass the list 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.

  1. Take the working set and extract those data items whose names imply they aren't monetary.

    To do this, point to Whole Set and drag the set onto Names of data items.

  2. Clear the existing defaults, by clicking Clear.

  3. Click Import and specify the file Criteria.txt, which is in the supplied EuroSmart directory structure with the path EuroSmart\Revolve\Sample\Euro\Order\Other.

    This adds the following strings to the search criteria: *date*, *-dd*, *-id*, *key*, *-mm*, *-no*, *-qty*, *quantity*, *weight* and *yyyy*.

  4. Click OK.

    The resulting set contains 33 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 and drag the non-monetary set onto the working set.

    The working set now contains 71 data items (104 minus 33).

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

  7. Tidy up by deleting the set of non-monetary data items containing 33 items and don't save it, in the same way as before.

6.9 Finding Monetary Constants

This section searches for monetary constants and captures the statements and data items that are associated with them. These monetary constants might need converting for euro amounts, and any statements or data items associated with them might need modifying too.

It is key that you identify these monetary constants in the Data Division and the Procedure Division early. Although changing these amounts is technically fairly trivial, determining which values need to be in euros 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 set "Potential monetary data items" onto Constants used with data items and statements, in the same way as before.

  2. Keep both check boxes checked, so that this search excludes irrelevant constants. For details of each exclusion click at the top right of the dialog and then click the check box.

  3. Click OK to run the tool.

    The resulting set contains 60 entries, which are a combination of 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 the new set "Monetary constants", in the same way as before.

  6. For demonstration purposes, separate out the data items from the set "Monetary constants", by dragging the set onto Filter set and checking only Data items.

    The resulting set contains 8 data items.

  7. Close the set of data items, since we don't need to keep these data items separately from the statements. However, on other occasions you might need to separate a mixed set into its constituents, so that you can go to process the separate sets through further analysis tools.

  8. Tidy up by closing the " Monetary constants" set and the "Potential monetary data items".

6.10 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. These discrepancies and how to rectify them are described later in the tutorials.

The next tutorial needs to use the Order project and the sets you have named, such as "Potential monetary data items". All of these are already saved and up to date.

You can break off from the tutorials now. If you want to work on your own code, you might need to change the options and settings back to the ones you use. See the Preparation section in this chapter, for how the tutorial changed them. When you can decide to follow the next tutorial, you will need to change back to the tutorials' settings again.


Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
Previous Loading a Project into the Database Populating the Worksheet Next