# CAST Engineering Dashboard - Metrics - number of metrics - incorrect value - Number of Decision Points

Description

This page treats the problems reported on the value of quantity Number of Decision points displayed in the COMPARE VERSIONS page.
The problems that are encountered can be that the value in the latest snapshot is:

1. Lower than expected (it has unexpectedly decreased compared to the previous value)
2. Greater than expected (it has unexpectedly increased compared to the previous value)
3. Zero (it is not computed)

You will find at the following page, the definition you need to compute this value
Functional weight - Number of Decision Points Definition

When facing such situations, the action plan is to have some knowledge on how this value is computed. Therefore, the paragraph 'Definition' gives you a short view on the specification of this quantity. Below you will find some examples that can lead to the observation

# Examples

## Unexpected decrease of the number of decision point

The problem occurs because the Snapshot Preparation Assistant (SPA) -with option Compute metrics set to all - was relaunched  while the source code for some analysis was not at the analysis original path.

Following errors can be seen in the SPA log file
File 'M:\<PATH>\RECD212A.COB' does not exist.
File 'M:\<PATH>\RECD215A.COB' does not exist.
File 'M:\<PATH>\RECD216A.COB' does not exist.
File 'M:\<PATH>\RECD220A.COB' does not exist.
File 'M:\<PATH>\RECD221A.COB' does not exist.
File 'M:\<PATH>\RECD225A.COB' does not exist.

## Number of decision point is Zero

The SPA is executed with option Compute metrics set to none and there is no job Metric Assistant to compute metrics

or

A syntax error was raised when computing metrics on the objects

# Notation

1. SP1: is the snapshot that was computed at first and taken for the comparison; it is therefore the reference of the comparison
2. SP2: is the snapshot that was computed at last and taken for the comparison;
3. KB1: Knowledge Base containing the results that participated to the generation of SP1
4. KB2: Knowledge Base containing the results that participated to the generation of SP2
5. CB: Central Base from which the comparison is launched
Applicable in CAST Version
Release
Yes/No
8.3.x
Action Plan

# Get the customer's input

Ask customer to provide the following input:

1. A screenshot of the Compare version page including the end of the URL, the Selected Context and the Date Range. This will enable to know which are the snapshots compared in the Dashoard and for which module/application/system
2. A dump of its central's repository
3. If there is (are) Metric Assistant (MA) job(s) executed on analysis results, then get the MA log file(s) executed on the job result's for SP1
4. If there is (are) Metric Assistant (MA) job(s) executed on analysis results, then get the MA latest log file(s) executed on the job result's for SP2
5. If there is no MA job, then get the  SPA latest log file executed on the job result's for SP1
6. If there is no MA job, then get the  SPA latest log file executed on the job result's for SP2
7. A dump of the KB that contains the results used for SP1: KB1
8. A dump of the KB that contains the results used for SP2: KB2
9. The analyzed sources in KB1: SRC1
10. The analyzed source code in KB2: SRC2

# Is the portfolio selection the same for both snapshot?

This section enable to check whether the 'Selected Context' (Module/Application/System) has the same content in both SP1 and SP2. To do this, follow the below steps:

1. Get from the screenshot the IDs of SP1 and SP2:
1. value of parameter snapshot in version prior to 6.4 which contains both SP1_id and SP2_id,
2. in version 6.4. get values of parameters dateinit  and dateend and execute below query to get  SP1_id and SP2_id
SELECT SNAPSHOT_ID, FUNCTIONAL_DATE  FROM DSS_SNAPSHOTS
WHERE FUNCTIONAL_DATE = to_date('dateinit ', 'yyyy/mm/dd HH24:MI:SS') or
FUNCTIONAL_DATE = to_date('dateend ', 'yyyy/mm/dd HH24:MI:SS')
Example: dateinit=20091020000000 dateend= 20100114000000
SELECT SNAPSHOT_ID, FUNCTIONAL_DATE FROM DSS_SNAPSHOTS
WHERE FUNCTIONAL_DATE = to_date('2009/10/20 00:00:00', 'yyyy/mm/dd HH24:MI:SS') or
FUNCTIONAL_DATE = to_date('2010/01/14 00:00:00', 'yyyy/mm/dd HH24:MI:SS')
2. Get from the screenshot the object ID- value of parameter object in the URL (obj_ID)
3. Import customer's CB
4. Get the object type
SELECT * from DSS_OBJECTS WHERE OBJECT_ID=obj_id

## The object is a module (OBJECT_TYPE_ID=20000)

1. Check if the module has been selected in both SP1 and SP2, to do this execute the following query against the KB
Select * From <CENTRAL_NAME>.DSS_CENTRAL_SELECTION where SNAPSHOT_ID in (SP1_id, SP2_id) and COMPUTE_NOW=1 and MODULE_ID=obj_ID
2. If previous query returns two lines, then the module is selected in both snapshot; go to step #Validate the MA or SPA Configuration
3. If the previous query returns only a line, then the module is not selected in both snapshot, therefore, inform customer that the comparison should be done among snapshots that contains the compared object and release the call

## The object is not a module

It is either an application (OBJECT_TYPE_ID=-102) or a system (OBJECT_TYPE_ID=-101) or a Corporate (OBJECT_TYPE_ID=-100),

1. Check if the object has been selected in both SP1 and SP2 by running the following query against the central
1. Before 6.4, use the following query
Select S.SNAPSHOT_ID, O.OBJECT_ID, O.OBJECT_TYPE_ID, O.OBJECT_NAME from DSS_SNAPSHOTS S, DSS_LINKS L, DSS_OBJECTS O
where S.SNAPSHOT_ID = L.PREVIOUS_OBJECT_ID
and S.SNAPSHOT_ID in (SP1_id,SP2_id)
and L.NEXT_OBJECT_ID = O.OBJECT_ID
and O.OBJECT_TYPE_ID in ( -100, -101, -102, 20000 )
and O.OBJECT_ID= obj_id
order by 1,2
2. From version 6.4, comparison cannot be performed at system or corporate level. So, to list the application and its internal module per snapshot, use the following query:
Select S.SNAPSHOT_ID, O.OBJECT_ID, O.OBJECT_TYPE_ID, O.OBJECT_NAME
from DSS_SNAPSHOTS S, DSS_OBJECTS O
where S.APPLICATION_ID = O.OBJECT_ID
and S.SNAPSHOT_ID in (SP1_id,SP2_id)
and O.OBJECT_ID= obj_idunion all
Select S.SNAPSHOT_ID, O.OBJECT_ID, O.OBJECT_TYPE_ID, O.OBJECT_NAME
from DSS_OBJECTS O, DSS_LINK_INFO L, DSS_SNAPSHOTS S
where S.APPLICATION_ID = L.PREVIOUS_OBJECT_ID
and S.SNAPSHOT_ID = L.SNAPSHOT_ID
and O.OBJECT_ID = L.NEXT_OBJECT_ID
and O.OBJECT_TYPE_ID = 20000
and O.OBJECT_ID= obj_idorder by 1, 2
1. Compare the content of the object by executing the following query against the CB
1. Before 6.4, use the following query
select O.OBJECT_ID, O.OBJECT_TYPE_ID, O.OBJECT_NAME
where L.PREVIOUS_OBJECT_ID = SP1_id - snapshot ID
and O.OBJECT_ID = L.NEXT_OBJECT_ID
and O.OBJECT_ID = obj_idand not exists
( select 1 from DSS_LINKS L2
where L2.PREVIOUS_OBJECT_ID = SP2_id - snapshot ID
and L2.NEXT_OBJECT_ID = L.NEXT_OBJECT_ID )
order by 1
2. From version 6.4, comparison cannot be performed at system or corporate level. So, use the following query to process the compare
select O.OBJECT_ID, O.OBJECT_TYPE_ID, O.OBJECT_NAME
from DSS_OBJECTS O, DSS_OBJECT_INFO OI
where O.OBJECT_ID = OI.OBJECT_ID
and OI.SNAPSHOT_ID = SP1_id - snapshot ID
and O.OBJECT_ID = obj_idand not exists
( select 1 from DSS_OBJECT_INFO OI2
where OI2.SNAPSHOT_ID = SP2_id - snapshot ID
and OI2.OBJECT_ID = OI.OBJECT_ID )
order by 1
2. If the object's content differs from a snapshot to another therefore this explain the difference in function point: inform customer on this difference and release the call
3. If the object's content is the same in both snapshot then go to step #Validate the MA or SPA Configuration

# Are the MA log files report the same information for both snapshots?

1. Open the MA logs for SP1 and SP2
2. Check that both logs has the same option set in section "Object Option"
3. Check that both logs has the same selection in section "Selected Objects from Analysis ..."
4. Check that both logs contains the same errors or warning on same object

## conclusion

1. If the MA configuration differs between the two versions then this can impact the number of objects participation to the computation of the metric
2. If some errors are in MA1 but not in MA2, therefore it may be normal that the quantity increases as there was more objects considered for the computation
3. If some errors are in MA2 but not in MA1, therefore it may be normal that the value of the quantity decreasese
4. If customer expects the same value for the quantity in SP1 and SP2 then from this point you can explain with above observation why there have been increase or decrease and release the call
5. if customer's does not agree with the updated value, then go to step "#Compare the jobs' analysis definition"

# Are the SPA log files report the same settings for both snapshots?

1. Open the SPA logs for SP1 and SP2
2. Check that both logs has the option "Compute metrics" set to  value "all"
3. Check that both logs contains the same errors or warning on same objects,

## conclusion

1. if the SPA for SP2 has its option "Compute metrics" set to none, then ask customer to reset its configuration and release the call
1. If some errors are in SPA1 but not in SPA2, therefore it may be normal that the quantity increases as there was more objects considered for the computation
2. If some errors are in SPA2 but not in SPA1, therefore it may be normal that the value of the quantity decreasese
3. If customer expects the same value for the quantity in SP1 and SP2 then from this point you can explain with above observation why there have been increase or decrease and release the call
4. if customer's does not agree with the updated value, then go to step "#Compare the jobs' analysis definition"

# Compare the jobs' analysis definition

1. Import both customer's KBs (KB1 and KB2)
2. Compare the definition of following wizards of the Analyzers
1. Job Definition wizard: option Compare the jobs' analysis definition
2. Project dependencies / Working Folder / Classpath / Target objects: compare the list of selected objects
3. File selection: check that the selected files/folder are the same

For instance, in call 17443, observation was that the first analysis (for SP1) doesn't contain selection in the working folder while there was selected folders in the latest analysis (for SP2) and those objects contribute to FP as the contain PROCEDURE DIVISION which expand the original analyzed source

## conclusion

If the configuration differs from a KB to another, this may explain the value in the Dashboard, therefore go to #Get the objects and their number of Decision Point in the KBs

# Get the objects and their number of Decision Point in the KBs

1. Count the number of objects that contributed to the computation of the Number of Decision points for both SP1 and SP2
if the value differs from a KB to another, raise the difference to the customer
2. Compute the value of the Number of Decision point available in the KBs with the one displayed on the Dashoard. The following query returns the number of artifacts and the total cyclomatic complexity for a module (job) in the KB for the last computed snapshot. The cyclomatic complexity total concerns only artifacts, not all objects:
select M.MODULE_ID, K.KeyNam, M.NB_ARTIFACTS, M.AVG_CYCLOMATIC * NB_ARTIFACTS "TOTAL_CYCLOMATIC"
from Keys K, DSSAPP_MODULES M
where M.MODULE_ID = K.IdKey

The query documented in the following page gives the CC per technology. The idea here is to have the CC per participating modules and then sum them up.

If the Sum (CC) in the KB is the same displayed in the Dashboard then the value is as expected contrary to what was raised by the customer
If the Sum(CC) of KB2 is not the same as the one displayed in the Dashboard then go to #Reproduce the problem

# Reproduce the problem

1. export the Portofolio tree from customer's CB
2. create a central and import customer's portfolio
3. generate a snapshot using customer's KB2

# Transmit the problem

1. KB2
2. Central configuration export
3. Explain where the problem comes from.