Description

The aim of this page is to check if the values reported on the dashboard for Number of  are the same as counted in the knowledge base involved for the snapshot computation.

Applicable in CAST Version

Release

Yes/No

8.3.x(tick)
Observed on RDBMS

RDBMS

Yes/No

CSS(tick)
Action Plan
  1. PLEASE NOTE:  THE QUERIES USED IN THIS PAGE ARE ONLY VALID IN CAST AIP 8.3.36 AND BELOW.  FOR CAST AIP 8.3.37 AND ABOVE YOU MUST MODIFY THE QUERIES AS FOLLOWS:

    • change references:
      • coa.properties  = 0
    • to
      • coa.properties & 255 = 0 


    • change references:
      • properties  = 0
    • to
      • properties & 255 = 0
  2. Select the page from the below list
  3. Check Known cases.
  4. If the Number of is observed at Module Level on dashboard then Calculate the Number of per module in the Knowledge Base.
    1. If the Number of per module in the Knowledge Base is equal to the number shown in the CAST Engineering Dashboard then the issue occurred at least at Module level (maybe a level lower then that: Analyzer level, Metamodel Level, extension level...):
      1. If the Number of per module in the Knowledge Base is greater then the expected value then there is objects that are not supposed to be part of the module, investigate the root cause by following the page CMS Application - Modules - Incorrect module content - Number of objects higher than expected
      2. Else If the Number of per module in the Knowledge Base is lower then the expected value then there are objects that are missing from the module, investigate the root cause by following the page CMS Application - Modules - Incorrect module content - Missing objects.
    2. Else If the Number of per module in the Knowledge Base is not equal to the number shown in the CAST Engineering Dashboard, then the issue occurred at CAST Engineering Dashboard level , contact CAST Technical Support and provide the following Relevant input
  5. Else If the Number of is observed at Application level on dashboard then go to section Calculate the Number of at application/system level in the Knowledge Base
    1. If the Number of per application in the Knowledge Base is equal to the number shown in the CAST Engineering Dashboard then the issue occurred at least at Module level (maybe a level lower then that: Analyzer level, Metamodel Level, extension level...):
      1. If the Number of per application in the Knowledge Base is greater then the expected value then there is objects that are not supposed to be part of modules, investigate the root cause by following the page CMS Application - Modules - Incorrect module content - Number of objects higher than expected
      2. Else If the Number of per application in the Knowledge Base is lower then the expected value then there is objects that are missing from the modules, investigate the root cause by following the page CMS Application - Modules - Incorrect module content - Missing objects.
    2. Else If the Number of per application in the Knowledge Base is not equal to the number shown in the CAST Engineering Dashboard, then the issue occurred at CAST Engineering Dashboard level , contact CAST Technical Support and provide the following Relevant input

Relevant input

  1. Screenshot of the dashboard with URL highlighting the Number of that you are looking at.
  2. CAST Support Tool (CST) - alias Sherlock export with the following options Export Logs, Export CAST Bases with Management Base, Knowledge Base, Central base

Calculate the Number of at application/system level in the Knowledge Base

If there is only one system and one application under it which has only one module then the Number of at System level = Application level = Module Level. So directly proceed to section Calculate the Number of per module in the Knowledge Base

Else if you are in one of the following case

  • One application with more than one module.
  • One system with more than one application.
  • One system with one application containing more than one module.

Then follow the steps given below:

  1. Identify the applications and modules belonging to the system with the help of CAST Engineering Dashboard.
  2. Go to Quick Access View.
  3. Expand the System and Application to get the list of Modules.
  4. Check the Module(s) under the application.

    Here in the above example we have application - Employee Portal, which has 5 modules - EP CICS , EP Cobol , EP DB2 , EP IMS , EP JCL
  5. Click on Monitor/Benchmark

    In the above example there are ten columns giving the number of for different modules in snapshot 1.8.3 and 1.8.4.
  6. Get the Number of for each module belonging to the system/application.
  7. Identify the module(s) generating the difference.

    Example

    In the screenshot shown in point 4, you can see that for Module EP Cobol the number of Files has decreased from 148 to 101. The difference in the number of Files at Application level is due to the change in number of Flies at Module Level.

  8. For all modules identified apply the steps given under Calculate the Number of per module in the Knowledge Base
  9. Once you get the numbers at module level apply the below formula.
    1. The Number of at application level is the sum of Number of obtained for its modules.
    2. The Number of at system level is the sum of Number of obtained for its applications.

Calculate the Number of per module in the Knowledge Base

PLEASE NOTE:  THE QUERIES BELOW ARE ONLY VALID IN CAST AIP 8.3.36 AND BELOW.  FOR CAST AIP 8.3.37 AND ABOVE YOU MUST MODIFY THE QUERIES AS FOLLOWS:

  • change references:
    • coa.properties = 0
  • to
    • coa.properties & 255 = 0 


  • change references:
    • properties = 0
  • to
    • properties & 255 = 0

This section allows you to get the Value of the Number of for each module in the knowledge base.

  1. Get the module ID by running the below query on the Knowledge Database

    set search_path = <Knowledge_database>;
    select s.idroot as "Module ID" , dos.object_name as "Module Name"
    from setroot s, dss_objects dos
    where s.idset = dos.object_id
    and dos.object_type_id = 20000
    order by s.idroot
    Example
    Result -
    389;"My Application full content"

Get value of the Number of and list of objects used to compute the Number of for each module ID retrieved in the above step.

Number of Comments Lines

Run the following query on the Knowledge Base:  

set search_path = <local_database>; 

select sum (InfVal) 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = <Module_ID> 
and InfTyp = 2 
and InfSubTyp = 0 
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'));
Example
set search_path = sample_local; 
 
select sum (InfVal) 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = 389 
and InfTyp = 2 
and InfSubTyp = 0 
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'));
 
Result - 1144

To get the list of objects contributing to the Number of comments execute the below query on the Knowledge Base.

set search_path = <local_database>; 
 
select InfVal as Comments,k.keynam as Object_Name 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = <Module_ID> 
and InfTyp = 2 
and InfSubTyp = 0 
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'))
Example
set search_path = sample_local; 
 
select InfVal as Comments,k.keynam as Object_Name 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = 389 
and InfTyp = 2 
and InfSubTyp = 0 
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'))
Result -
"comments";"object_name"
1041;"PG1004"

Number of Commented-out code lines

To get the number of commented-out lines of an application's non-external objects, run the following query

set search_path = <local_database>; 
 
select InfVal as Comments,k.keynam as Object_Name 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = <Module_ID> 
and InfTyp = 9
and InfSubTyp = 1509
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'))

To get the list of objects contributing to the Number of commented-out code lines execute the below query on the Knowledge Base.

Example
 select InfVal as Comments,k.keynam as Object_Name 
from ObjInf oi, keys k, ctt_object_applications COA 
where oi.IdObj = k.IdKey 
AND COA.object_id = k.IdKey 
and coa.properties = 0 
and coa.application_id = 389 
and InfTyp = 9 
and InfSubTyp = 1509
and k.ObjTyp in (select distinct t.IdTyp 
from Typ t, TypCat tc 
where t.IdTyp = tc.IdTyp 
and tc.IdCatParent in (select Cat.IdCat 
from Cat 
where CatNam like 'APM Sources'))

  

Number of Paragraphs

Run the following query on the Knowledge Base

set search_path = <local_database>;

SELECT COUNT(k1.idkey)
FROM keys k1,
keys k2
WHERE k1.idkey IN (SELECT ( object_id )
FROM ctt_object_applications
WHERE application_id = <Module_ID>
AND properties = 0)
AND k1.idkey = k2.idkey
AND k2.objtyp = 606 ;

To get the list of objects contributing to the Number of paragraphs execute the below query on the Knowledge Base.

Example
set search_path = <local_database>; 

SELECT k1.idkey as Object_ID, k1.keynam as Object_Name
FROM keys k1,
keys k2
WHERE k1.idkey IN (SELECT ( object_id )
FROM ctt_object_applications
WHERE application_id = <Module_ID>
AND properties = 0)
AND k1.idkey = k2.idkey
AND k2.objtyp = 606

Number of CopyBooks

Run the following query on the Knowledge Base:  

set search_path = <local_database>; 

SELECT COUNT(k1.idkey)
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp = 544

To get the list of objects contributing to the Number of copybooks execute the below query on the Knowledge Base.

Example
 SELECT k1.idkey,k1.keynam
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp = 544

Number of Sections


Run the following query on the Knowledge Base:  

set search_path = <local_database>; 

SELECT COUNT(k1.idkey)
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp = 548

To get the list of objects contributing to the Number of sections execute the below query on the Knowledge Base.

Example
 SELECT k1.idkey,k1.keynam
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp = 548

Number of Files


Run the following query on the Knowledge Base:  

 SELECT COUNT(k1.idkey)
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id  = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp IN (SELECT DISTINCT t.idtyp
 FROM typ t,
 typcat tc
 WHERE t.idtyp = tc.idtyp
 AND tc.idcatparent IN (SELECT cat.idcat
 FROM cat
 WHERE
 catnam LIKE 'APM Inventory Files'))

To get the list of objects contributing to the Number of Files execute the below query on the Knowledge Base.

Example
SELECT k1.idkey , K1.keynam
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id  = 389
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp IN (SELECT DISTINCT t.idtyp
 FROM typ t,
 typcat tc
 WHERE t.idtyp = tc.idtyp
 AND tc.idcatparent IN (SELECT cat.idcat
 FROM cat
 WHERE
 catnam LIKE 'APM Inventory Files'))

Number of Programs


Run the following query on the Knowledge Base:  


SELECT COUNT(k1.idkey)
FROM keys k1,
keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp IN (SELECT DISTINCT t.idtyp
 FROM typ t,
 typcat tc
 WHERE t.idtyp = tc.idtyp
 AND tc.idcatparent IN (SELECT cat.idcat
 FROM cat
 WHERE
 catnam LIKE 'APM Inventory Programs'))

To get the list of objects contributing to the Number of Programs execute the below query on the Knowledge Base.

SELECT k1.idkey,k1.keynam
FROM keys k1,
 keys k2
WHERE k1.idkey IN (SELECT ( object_id )
 FROM ctt_object_applications
 WHERE application_id = <Module_ID>
 AND properties = 0)
 AND k1.idkey = k2.idkey
 AND k2.objtyp IN (SELECT DISTINCT t.idtyp
 FROM typ t,
 typcat tc
 WHERE t.idtyp = tc.idtyp
 AND tc.idcatparent IN (SELECT cat.idcat
 FROM cat
 WHERE
 catnam LIKE 'APM Inventory Programs'))

Query for other Number Of that is not listed above

  1. Get the <CategoryIDs> or <TypeIDs> values with <Criterion> if any, from the page CMS Assessment model - Information - Metric Category names and Ids
    For example for Number of tables the category name is DataBase Table and for Number of WEB Pages the typID is 274 
  2. Substitute the values in the appropriate query to get the number of
    For Category:

    SELECT COUNT(k1.idkey) FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C
    WHERE application_id = <Module_ID> 
    AND properties = 0) 
    AND k1.idkey = k2.idkey 
    AND k2.objtyp IN (SELECT DISTINCT t.idtyp 
    FROM typ t, typcat tc 
    WHERE t.idtyp = tc.idtyp 
    AND tc.idcatparent IN (<CategoryIDs>))
    [AND <Criterion>]   -- To be used if Criterion exists

    In the below example we are trying to get the Number of tables for which the category name is DataBase Table.

    Example
    SELECT COUNT(k1.idkey) FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C
    WHERE application_id = 389 
    AND properties = 0) 
    AND k1.idkey = k2.idkey 
    AND k2.objtyp IN (SELECT DISTINCT t.idtyp 
    FROM typ t, typcat tc 
    WHERE t.idtyp = tc.idtyp 
    AND tc.idcatparent IN (6100))

    For Type:

    SELECT COUNT(k1.idkey) 
    FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C 
    WHERE application_id = <application_id> 
    AND properties = 0) AND k1.idkey = k2.idkey AND k2.objtyp in (<TypeIDs>)
    [AND <Criterion>]   -- To be used if Criterion exists

    In the below example we are trying to get the Number of WEB Pages for which the <TypeID> is 274

    SELECT COUNT(k1.idkey) 
    FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C 
    WHERE application_id = 389 
    AND properties = 0) AND k1.idkey = k2.idkey AND k2.objtyp = 274
    AND exists (select 1
                  from CTT_OBJECTS O
                 where O.OBJECT_ID = C.OBJECT_ID
                   and (O.OBJECT_NAME like '%.jsp'
                     or O.OBJECT_NAME like '%.js'
                     or O.OBJECT_NAME like '%.aspx'
                     or O.OBJECT_NAME like '%.asmx'
                     or O.OBJECT_NAME like '%.ascx'
                     or O.OBJECT_NAME like '%.asax'
                     or O.OBJECT_NAME like '%.asp'
                     or O.OBJECT_NAME like '%.htc'
                     or O.OBJECT_NAME like '%.htm'
                     or O.OBJECT_NAME like '%.html'
                     or O.OBJECT_NAME like '%.xhtml'
                       )
               )
  3. Get list of the objects by using the queries
    For Categories

    SELECT k1.idkey,K1.keynam FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C
    WHERE application_id = <Module_ID> 
    AND properties = 0) 
    AND k1.idkey = k2.idkey 
    AND k2.objtyp IN (SELECT DISTINCT t.idtyp 
    FROM typ t, typcat tc 
    WHERE t.idtyp = tc.idtyp 
    AND tc.idcatparent IN (<CategoryIDs>))
    [AND <Criterion>]   -- To be used if Criterion exists

     For Type

    SELECT k1.idkey,k1.keynam
    FROM keys k1, keys k2 
    WHERE k1.idkey IN (SELECT ( object_id ) 
    FROM ctt_object_applications C
    WHERE application_id = <application_id> 
    AND properties = 0) AND k1.idkey = k2.idkey AND k2.objtyp in (<TypeIDs>)
    [AND <Criterion>]   -- To be used if Criterion exists

Known cases 

PLEASE NOTE:  THE QUERIES BELOW ARE ONLY VALID IN CAST AIP 8.3.36 AND BELOW.  FOR CAST AIP 8.3.37 AND ABOVE YOU MUST MODIFY THE QUERIES AS FOLLOWS:

  • change references:
    • coa.properties  = 0
  • to
    • coa.properties & 255 = 0 


  • change references:
    • properties  = 0
  • to
    • properties & 255 = 0
  1. Number of Files
    ABAP - In CAST 7.0 the metric "Number of Files" is not counted anymore for ABAP Application. This information has no sense for ABAP Technology.
    SAP files (corresponding to ABAP code, transaction list, Web Dynpro structure, …) are created by the CAST ABAP extractor to allow the ABAP Analyzer to extract information from SAP applications. It is important to note that they are not used by developers to implement SAP applications and this is why it does not make sense to count them and to report this information in the ADG dashboard as for technologies based on source files. Moreover, the number of files generated by the ABAP extractor depends on the information that must be taken into account and how it must be analyzed.
    In versions 6 of CAST AIP, files extracted from SAP systems were counted although this information was not significant. This has been changed in version 7.0 of CAST AIP. However, as the counter is part of generic counters provided for many technologies, it is still displayed in the dashboard and it is always set to 0.

    Check the number of files between the current snapshot and the previous one, to find the number of files

  2. Number of tables
    SQL - In the dashboard, only internal objects are taken into account; however, to be able to display their names when needed, external objects are also stored in KB and CB. That’s why there is difference, so when counting objects from the database, you must take care of the object status (internal/external)

  3. Number of Copybooks
    COBOL - If copybooks are selected with programs, then they are all taken into account (because they are all analyzed). If they are selected through Working Folders, then only those that are used by programs are taken into account. Number displays copybooks that are taken into account.

  4. Number of Classes/interfaces
    When using explicit lists at module level, make sure that your modules only contain internal objects. Indeed, when a module contains an external object (class/interface), this object is marked as internal for one project of the SPA job making it taken into account in the count of number of interfaces. Generally, external objects should not be included in User Defined Modules (even through explicit list) as this could generate incoherence on the dashboard between results in the number of (number of interfaces/classes...) and total checks returned by rules (indeed, all diags filter the scope to internal objects only). To make sure that an explicit list does not contains external objects, add the following condition in the explicit list along with your query on object_ids:

    join $CTT_OBJECT_APPLICATIONS coa
    on coa.object_id = o.object_id 
    and coa.properties = 0 --only internal objects 
    and coa.application_type not in 
    	( select tc.IdTyp from TYPCAT tc, CAT c 
    	where tc.IdCatParent = c.IdCat 
    	and c.idcat = 6600 --PROJECT_SUBSET )  

     

  5. Number of comment lines
    COBOL - A comment line is identified if it contains a star ('*') in indicator area (often in column 7). AIP considers 2 types of comment lines: 

    1. Heading comment lines: they are just before the first line of code of programs or paragraphs.
    2. Inner comment lines: they are in the body of the object.
    A comment line is taken in account whatever its content. It can contain text, "decorative" chars (ex: "===", "*****", ...) or nothing. A program or a paragraph is considered as not documented if the number of heading comment lines and the number of inner comment lines equal 0.
  6. Number of SQL artifacts
    For number of SQL artifacts refer to Number of SQL Artifacts

  7. Number of packages

    Number of packages is applicable only for Java and ABAP Packages.

    You can see that the SQL procedure used to compute the number of packages is APM_SCOPE_PACKAGES.

    Which calls the procedure APM_SCOPE_CATEGORY for objects which belong to the category ID 10064 (which is the last parameter passed to APM_SCOPE_CATEGORY )

    You can execute the below query on the Knowledge base to get the object types belonging to this category ID 10064 -

    select * from Typ where IdTyp in (select IdTyp from TypCat where IdCatParent = 10064)
    Result
    99;"JV_PACKAGE";"Java Package";"ACTIVE    "
    133039;"CAST_ABAP_Package";"ABAP Package";"ACTIVE    "

     From the above results we can see that this metric is applicable only on Java and ABAP Packages, if you have packages for any other technology this metric is always displayed as zero.

Notes / Comments


Related Pages