Procedures with excessive parameters are difficult to use, as one needs to figure out what each parameter is.

In many cases, the procedure can either be split into several smaller ones, or a better data structure can be found.

This rule verifies that each procedure has at most the given number of parameters.

== Noncompliant Code Example

----
foo: proc options(main);
  declare myArray (9) fixed decimal init (1, 2, 3, 4, 5, 6, 7, 8, 9);

  put list (mySum(myArray(1), myArray(2), myArray(3), myArray(4), myArray(5), myArray(6), myArray(7), myArray(8), myArray(9)));
end;

mySum: proc (a1, a2, a3, a4, a5, a6, a7, a8, a9) returns (fixed decimal); /* Non-Compliant - too many parameters */
  declare (a1, a2, a3, a4, a5, a6, a7, a8, a9) fixed decimal;

  return (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9);
end;
----

== Compliant Solution

----
foo: proc options(main);
  declare myArray (9) fixed decimal init (1, 2, 3, 4, 5, 6, 7, 8, 9);

  put list (sum(myArray));  /* Compliant - uses the built-in sum() function which works on an array */
end;
----

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
