IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2012-11-07T10:11:58Z by SystemAdmin
849 Posts

Pinned topic (1) Dead code metrics + (2) List of programs calling a program

‏2012-10-29T16:25:05Z |
Requesting your suggestions on the below queries.

1. Reg: Dead Code analysis:
We are looking for RAA related metrics called “Dead Code” – this is at the program level(That is, dead code needs to be viewed at each program level; while we have a huge number of programs to be analyzed for dead code.
Is there any Custom query which can generate this metric (program name, number # of dead code LOC, dead code stmt numbers \ line) for Cobol programs on application level. Or is there any DMH table source for this?
2. List of programs calling a given program:
There is a diagram which shows the Fan-Out (no. of sub-programs) for any Cobol program.
We need to know if there is a way we can get the Fan-in (List of all programs that call this program).
Is this present in any tables DMH table?
Updated on 2012-11-07T10:11:58Z at 2012-11-07T10:11:58Z by SystemAdmin
  • jcdelmo
    343 Posts

    Re: (1) Dead code metrics + (2) List of programs calling a program

    ‏2012-10-29T18:54:16Z  in response to SystemAdmin
    1) In the current release of RAA (v6.0.0.10) the 'dead code' (or more properly stated *unreachable code*) attribute for COBOL statements is not persisted in the data base. The 'dead code' detection is on-demand - a program-at-a-time, therefore the custom query your are after can not be written. The next fix pack (v6.0.0.11 - due out within the next two weeks) will persist the Code Review for COBOL rule results (including unreachable code) in the DMH_NUM_PROPERTY table. At that point custom queries may be written to access these metrics.

    2) The following SQL will give you all the programs that call a given program, assuming you replace ? with the comp_unit_id of the called program. It is the same query used on the Program detail page's Control transfer tab when the calling programs radio button is selected.

    SELECT cu.comp_unit_id , cu.comp_unit_name FROM $(SCHEMA).dmh_compile_unit cu , (SELECT DISTINCT cu.comp_unit_id FROM $(SCHEMA).dmh_run_unit_cntnt ruc , $(SCHEMA).dmh_compile_unit cu WHERE ruc.target_cu_id = ? AND ruc.caller_cu_id = cu.comp_unit_id) cu1 WHERE cu.comp_unit_id = cu1.comp_unit_id ORDER BY cu.comp_unit_name
    • SystemAdmin
      849 Posts

      Re: (1) Dead code metrics + (2) List of programs calling a program

      ‏2012-11-07T10:11:58Z  in response to jcdelmo
      Thank you, that helped.