include::../description.adoc[]

include::../how-to-fix-it.adoc[]

=== Code examples

==== Noncompliant code example

[source,cobol,diff-id=1,diff-type=noncompliant]
----
DATA DIVISION.
    WORKING-STORAGE SECTION.
        01 WS-COUNT PIC 9(1) VALUE 0.
PROCEDURE DIVISION.
    A-PARA.
    PERFORM B-PARA UNTIL WS-COUNT=5                      *> Noncompliant - 5 is a magic number
    STOP RUN.

    B-PARA.
    DISPLAY "Count:"WS-COUNT.
    ADD 1 TO WS-COUNT.
----

==== Compliant solution

[source,cobol,diff-id=1,diff-type=compliant]
----
DATA DIVISION.
    WORKING-STORAGE SECTION.
        01 WS-COUNT            PIC 9(1) VALUE 0.
        01 WS-NUMBER-OF-CYCLES PIC 9(1) VALUE 5.
PROCEDURE DIVISION.
    A-PARA.
    PERFORM B-PARA UNTIL WS-COUNT=WS-NUMBER-OF-CYCLES    *> Compliant
    STOP RUN.

    B-PARA.
    DISPLAY "Count:"WS-COUNT.
    ADD 1 TO WS-COUNT.    *> Compliant - 1 is not considered a magic number
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
