SQL Queries - CAST Central Base - Queries on applications - How to get the Number of Lines of Code by Snapshot for an Application
Purpose of Query
This document provides a query to get the number of Lines of Code by Snapshot for an Application.
Applicable CAST Version
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
| 8.2.x | ✅ |
Applicable RDBMS
| RDBMS | Yes/No |
|---|---|
| Oracle Server | ✅ |
| Microsoft SQL Server | ❓ |
| CSS | ✅ |
Query for CSS
SELECT DSSO.OBJECT_NAME AS APPLICATION ,
DSSS.SNAPSHOT_NAME AS SNAPSHOT ,
m.METRIC_NUM_VALUE AS "Number of Code Lines"
FROM DSS_METRIC_RESULTS m
JOIN DSS_OBJECTS DSSO
ON DSSO.OBJECT_ID=m.OBJECT_ID
JOIN DSS_SNAPSHOTS DSSS
ON DSSS.SNAPSHOT_ID=M.SNAPSHOT_ID
WHERE M.SNAPSHOT_ID = <SNAPSHOT_ID> -- here 2
AND M.OBJECT_ID = <APPLICATION_ID> -- here 3
AND m.METRIC_ID = 10151
Query result example
“App1”;“V2-COBOL-1APP-2016-MR2-11082016”;1070390
Query result interpretation
Snapshot “V2-COBOL-1APP-2016-MR2-11082016” of Application “App1” contains 1070390 lines of code
Query for Oracle
SELECT DSSO.OBJECT_NAME AS APPLICATION ,
DSSS.SNAPSHOT_NAME AS SNAPSHOT ,
m.METRIC_NUM_VALUE AS "Number of Code Lines"
FROM DSS_METRIC_RESULTS m
JOIN DSS_OBJECTS DSSO
ON DSSO.OBJECT_ID=m.OBJECT_ID
JOIN DSS_SNAPSHOTS DSSS
ON DSSS.SNAPSHOT_ID=M.SNAPSHOT_ID
WHERE M.SNAPSHOT_ID = <SNAPSHOT_ID> -- here 98
AND M.OBJECT_ID = <APPLICATION_ID> -- here 468616
AND m.METRIC_ID = 10151
Query result example
APPLICATION SNAPSHOT Number of Code Lines
App2 App2 01/12/2016 10:50:50 2751
1 record(s) selected [Fetch MetaData: 0/ms] [Fetch Data: 1/ms]
[Executed: 03/02/17 09:36:49 GMT ] [Execution: 920/ms]
Query result interpretation
Snapshot “App2 01/12/2016 10:50:5” of Application “App2” contains 2751 lines of code.
Notes/comments
Related Pages