Cyclomatic complexity

Cyclomatic complexity is a measurement developed by Thomas McCabe to determine the stability and level of confidence in a program. It measures the number of linearly-independent paths through a program module. Programs with lower Cyclomatic complexity are easier to understand and less risky to modify.

Rational® Asset Analyzer calculates an approximation of Cyclomatic complexity for COBOL and PL/I programs by counting the splitting nodes in a program and adding one. A splitting node is a logic branch point in a program, a point at which one or more paths through the program can be taken according to the outcome of some logical operation. A splitting node is a branch point with more than one path leading to other nodes. A nonsplitting node has just one path leading to another node.

Rational Asset Analyzer calculates splitting nodes for COBOL programs by counting the following:
  • Incrementing by 1 for any EXEC CICS® HANDLE statement.
  • Incrementing by 1 for any EXEC CICS LINK statement.
  • Incrementing by 1 for any EXEC XCTL statement.
  • Incrementing by 1 for each of the following reserved words:
    • ALSO
    • ALTER
    • AND
    • DEPENDING
    • END-OF-PAGE
    • ENTRY
    • EOP
    • EXCEPTION
    • EXIT
    • GOBACK
    • IF
    • INVALID
    • OR
    • OVERFLOW
    • SIZE
    • STOP
    • TIMES
    • UNTIL
    • USE
    • VARYING
    • WHEN
Rational Asset Analyzer calculates splitting nodes for PL/I programs by counting the following:
  • Incrementing by 1 for each of the following reserved words:
    • EXIT
    • IF
    • logical AND
    • logical OR
    • ON
    • WHEN
    • UNTIL
    • WHILE
    • STOP