Rule Definition
The NEXT SENTENCE statement is a GO TO-like statement, which transfers control to the next sentence in the code; since a period indicates the end of the current sentence, the NEXT SENTENCE statement can lead to programming errors when a period is removed or added without proper care.
Remediation
Replace the NEXT SENTENCE by CONTINUE as much as possible.
Violation Code Sample
* If INPUT-REC-TYPE = 0 then INPUT-COUNT is not
* incremented...
IF NOT INPUT-EOF
IF INPUT-REC-TYPE = '55'
PERFORM 2100-PROCESS-WTN
ELSE
NEXT SENTENCE
END-IF
ADD +1 TO INPUT-COUNT.
Fixed Code Sample
* If INPUT-REC-TYPE = 0 then INPUT-COUNT is
* incremented.
IF NOT INPUT-EOF
IF INPUT-REC-TYPE = '55'
PERFORM 2100-PROCESS-WTN
ELSE
CONTINUE
END-IF
ADD +1 TO INPUT-COUNT.
Related Technologies
Cobol
Technical Criterion
Programming Practices - Structuredness
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.