COBOL Program

Metric Description
3-Maintainability 3-MI = 171 - 5.2 * ln (PgmVolume) - 0.23 * ExtCycComp - 16.2 * ln (LOC), where PgmVolume is Program Volume, ExtCycComp is Extended Cyclomatic Complexity, and LOC is Lines of Code.
Absolute Complexity Binary Decisions divided by the number of statements.
Asynchronous Calls Number of asynchronous calls, such as COBOL INITIATE statements.
Binary Decisions Number of branching conditions in the flow graph with two possible outcomes. Includes statements with implicit condition evaluation (loops, AT END, and so on): IF, EVALUATE (number of WHEN except WHEN OTHER), PERFORM…TIMES, PERFORM…UNTIL, PERFORM…VARYING, PERFORM…VARYING…AFTER (number of AFTER phrases + 1), statements with ON/NOT ON, AT END/NOT AT END, INVALID/NOT INVALID (one decision per statement), GOTO…DEPENDING ON (number of alternatives), SEARCH (number of WHEN, AT END). IDMS: IF.
Computational Statements Number of statements performing arithmetic calculations: ADD, SUBTRACT, DIVIDE, MULTIPLY, COMPUTE.
Conditional Complexity Binary Decisions, plus Unique Operands in Conditions.
Conditional Statements Number of branching statements with nested statements executed under certain conditions, not including conditional GOTOs. IF, EVALUATE, SEARCH, PERFORM…UNTIL, PERFORM…VARYING…UNTIL, statements with ON/NOT ON, AT END/NOT AT END, INVALID/NOT INVALID. IDMS: IF.
Cyclomatic Complexity v(G) = e - n + 2, where v(G) is the cyclomatic complexity of the flow graph (G) for the program in question, e is the number of edges in G, and n is the number of nodes. Quantity of decision logic. The number of linearly independent paths (minimum number of paths to be tested). v(G) = DE + 1, where DE is the number of binary decisions made in the program.
Data Elements Number of declared data items (elementary structures and their fields).
Dead Data Elements Number of dead data elements in programs and used include files. Dead data elements are unused structures at any data level, all of whose parents and children are unused.
Dead Data Elements from Includes Number of dead data elements in include files. Dead data elements are unused structures at any data level, all of whose parents and children are unused.
Dead Lines Number of dead lines in programs and used include files. Dead lines are source lines containing Dead Data Elements or Dead Statements. Also, source lines containing dead constructs.
Dead Lines from Includes Number of dead lines in include files. Dead lines are source lines containing Dead Data Elements from Includes or Dead Statements from Includes. Also, source lines containing dead constructs.
Dead Statements Number of dead statements in programs and used include files. A dead statement is a procedural statement that can never be reached during program execution.
Dead Statements from Includes Number of dead statements in include files. A dead statement is a procedural statement that can never be reached during program execution.
Difficulty D = (n1 / 2) * (N2 / n2), where n1 is Unique Operators, N2 is Operands, and n2 is Unique Operands.
Entry Points Number of program entry points: PROCEDURE DIVISION, ENTRY.
Error Estimate B = E**(2/3) / 3000, where E is Programming Effort.
Essential Complexity Quantity of unstructured logic (a loop with an exiting GOTO statement, for example). v(G) for reduced graph without D-structured primes.
Executable Statements All Procedure Division statements, plus CONTINUE and NEXT STATEMENT.
Extended Cyclomatic Complexity Cyclomatic Complexity, plus Logical Operators in Conditions. Number of all paths in the program.
Function Points Lines of Code divided by K, where K depends on the language: COBOL=77, Natural=52, PL/I=67. Estimate of the number of end-user business functions implemented by the program.
GoTo Statements Number of GOTO statements, including conditional GOTOs.
Inner Call Statements Number of statements that invoke Inner Procedures: PERFORM procedure-name.
Inner Procedures Number of structured pieces of code that cannot be invoked from external programs: COBOL paragraphs (including nameless).
Intelligent Content I = L * V, where L is Program Level and V is Program Volume. Complexity of a given algorithm independent of the language used to express the algorithm.
IO Statements Number of statements performing input/output operations: OPEN, CLOSE, READ, WRITE, REWRITE, DELETE, START, SORT, MERGE, RETURN, RELEASE, ACCEPT, DISPLAY, STOP literal. SQL: INSERT, FETCH, SELECT, UPDATE, DELETE, EXECUTE. CICS: CONVERSE, SEND, SEND MAP, SEND TEXT, RECEIVE, RECEIVE MAP, RECEIVE TEXT, READQ, WRITEQ, DELETEQ, READ, READNEXT, READPREV, WRITE, REWRITE, DELETE. IDMS: ERASE, OBTAIN, GET, MODIFY, STORE.
Lines of Code Number of lines of code, plus the number of lines of code in included files and any files they include. Comments and blank lines are not counted.
LINK Statements Number of CICS LINK statements.
Logical Operators in Conditions Number of binary logical operators used in conditions: AND, OR.
Loop Statements Number of repetitively executing statements: PERFORM…TIMES, PERFORM…UNTIL, PERFORM…VARYING PERFORM…VARYING…AFTER (# of AFTER + 1).
Maintainability Index MI = 171 - 5.2 * ln (PgmVolume) - 0.23 * ExtCycComp - 16.2 * ln (LOC) + 50 * sin (sqrt (2.46 * CommentLines/SourceLines)), where PgmVolume is Program Volume, ExtCycComp is Extended Cyclomatic Complexity, LOC is Lines of Code, CommentLines is Comment Lines, and SourceLines is Source Lines.
Nesting Level Maximum nesting of conditional statements within conditional statements (0 if no conditional statements, 1 if no nesting).
Non-returning Calls Number of non-returning calls, such as COBOL XCTL statements.
Number of Code Lines Without Copy Number of lines of source code. Included files are not counted. Comments and blank lines are not counted.
Operands Number of operand occurrences (N2). Operands are variables and literals used in operators. Compare Unique Operands.
Operators Number of operator occurrences (N1). Operators are executable statements and unary and binary operations: +, -, *, /, **, NOT, AND, OR, <, <=, >, >=, =, IS, (subscript), (reference:modification), FUNCTION. Compare Unique Operators.
Parameters Number of COBOL Procedure Division USING...RETURNING parameters.
Pointers Number of data elements declared as pointers. Data items with USAGE IS POINTER, PROCEDURE-POINTER.
Program Length N = N1 + N2, where N1 is Operators and N2 is Operands.
Program Level L = 1 / D, where D is Difficulty.
Program Volume V = N * log2(n), where N is Program Length and n is Vocabulary. Minimum number of bits required to code the program.
Programming Effort E = V / L, where V is Program Volume and L is Program Level. Estimated mental effort required to develop the program.
Programming Time T = E / 18, where E is the Programming Effort and 18 is Stroud’s Number. Estimated amount of time required to implement the algorithm, in seconds.
Recursive Number Of Comments With Copy Number of lines of source containing comments, plus the number of lines of source containing comments in included files and any files they include. Inline comments placed on lines with statements are not counted.
Recursive Number Of Source Lines With Copy Number of lines of source, plus the number of lines of source in included files and any files they include. Comments and blank lines are counted.
Response for Class Response for class.
Unique Operands Number of distinct operands (n2). Operands are variables and literals used in operators. Uniqueness of literals is determined by their notation. Compare Operands.
Unique Operands in Conditions Number of distinct operands used in conditions.
Unique Operators Number of distinct operators (n1). Operators are executable statements and unary and binary operations: +, -, *, /, **, NOT, AND, OR, <, <=, >, >=, =, IS, (subscript), (reference:modification), FUNCTION. Compare Operators.
Vocabulary n = n1 + n2, where n1 is the number of Unique Operators and n2 is the number of Unique Operands.