Avoid Functions and Procedures having a SELECT without the default OTHERWISE clause (PL1) | CAST Appmarq

Avoid Functions and Procedures having a SELECT without the default OTHERWISE clause (PL1)


Rule Definition
The default case is executed when none of the conditions being tested for in the switch statement are met or executed. Having no default, means that there is no backup. The cases that are "impossible" today are the ones most likely to be the causes of untraceable bugs in the future, when the impossible changes to the standard.

Remediation
Add the OTHERWISE clause for the SELECT statement not having one.

Violation Code Sample
SELECT(COND);
WHEN(A)
DO;
...
END;
WHEN(B)
DO;
...
END;
WHEN(C)
DO;
...
END;
Fixed Code Sample
SELECT(COND);
WHEN(A)
DO;
...
END;
WHEN(B)
DO;
...
END;
WHEN(C)
DO;
...
END;
OTHERWISE
DO;
...
END;

Related Technologies

Health Factor

  Total Quality Index


Technical Criterion
CWE-478 - Missing Default Case in Multiple Condition Expression

About CAST Appmarq

CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.

Benchmark Statistics

Global Compliance

99.70%

Total Violations
119
Total Opportunities
39,719
Average Violations / App.
19.83
The compliance score represents 1 minus the ratio between the number of times a rule has been violated compared to the number of opportunities in a set of applications that the rule could have been violated.

Industry Insights

Manufacturing

99.81%

Financial Services

99.76%