This page describe an issue when the analysis of RPG is done using RPG package < 1.0.4. When looking at the dashboard results, you find out that LOC is double that of the expected one for DB400 logical files. 



Release
Yes/No
8.3.x(tick)




RDBMS
Yes/No
CSS (tick)



Below is the step-by-step scenario leading to the problem:

  1. Do Analysis and snapshot for RPG language using RPG package < 1.0.4
  2. While Validating the dashboard, you find out that LoC is the double of the expected one for DB400 logical files.


The impact of the problem on the analysis or the dashboard is: the LoC pf DB400 logical files is doubled.


Issue is due to the fact that LOC is counted twice in the "File which contains the source code" and in the one of the 2 types ( "DB400 Physical File", "DB400 Logical File") when they only should be counted only once. To check that this is your case, you can

  1. Run the following query on KB

    select distinct object_type_description, sum(case when t1.metric_id=10151 then t1.metric_num_value end) as code_lines
       from dss_metric_results t1, dss_objects t2 , dss_object_types t3
     where  t1.object_id = t2.object_id
       and t2.object_type_id = t3.object_type_id
        and t3.object_group = 0
      group by 1 order by 1 desc

    Here is an example of the results for the query 

    "File which contains source code";3003

    "DDS400 Printer File";691

    "DDS400 Display File";117

     "DB400 Physical File";1803 --not expected

     "DB400 Logical File";392 --not expected

    From the first line, this means that LoC computed for "File which contains source code" type is 3003 

    As you can see in the results of the query above, the LOC is counted twice: once in the "File which contains source code" and then in  "DB400 Physical File" or "DB400 Logical File" which is not expected. This results in the overall LoC to be doubled. 

    To fix the problem, proceed as follows

    1. For %appdata%\CAST\CAST\7.3\Configuration\Languages\DB400\DB400MetaModel.xml, do the following 2 modifications :



      put following line in comment, changing:
         <inheritedCategory name="APM Sources"/> --in line 11
         to
         <!--inheritedCategory name="APM Sources"/–>




      In the DB400LogicalFile type, change:
          <inheritedCategory name="APM SQL Language Artifacts"/> --in line 65
          to
          <inheritedCategory name="APM SQL Artifacts"/>


      Note that you should apply this modification (putting <!--inheritedCategory name="APM Sources"/--> into comment to all the RPG technologies you have at your side modifying associated meta model.

    2. Once modification done, in servman, load metamodel from disk for the 3 schemas CB/KB/MB for the changes to be taking into account,
    3. Then run the analysis and generate the snapshot.
    4. When running the same query on KB:

      select distinct object_type_description,
      sum(case when t1.metric_id=10151 then t1.metric_num_value end) as code_lines
        from dss_metric_results t1, dss_objects t2 , dss_object_types t3
      where  t1.object_id = t2.object_id
         and t2.object_type_id = t3.object_type_id
         and t3.object_group = 0
       group by 1
      order by 1 desc

      We can see that LOC is now no longer computed for "DB400 Physical File" and "DB400 Logical File" only at  "File which contains source code" level:

      "File which contains source code";3003
      "DDS400 Printer File";691
      "DDS400 Display File";117
      "DB400 Physical File";
      "DB400 Logical File";




LoC is no longer doubled for RPG DB400 technologies.


Issue is planned to be fixed in RPG 1.0.4 package

Ticket # 4919, 12497 


 CAST Engineering Dashboard - Metrics - Lines of code - Unexpected increase or decrease