A COBOL
paragraph contains one (actually zero) or more sentences. A
sentence is a series of statements terminated by a period (a.k.a. full stop). A
statement starts with a
verb (i.e. MOVE, ADD, STOP, IF) and may contain one or more clauses.
NEXT SENTENCE is similar to a statement that is essentially a GO TO. NEXT SENTENCE causes the transfer of control (i.e. a GO TO) to the statement following the period (full stop) that terminates the sentence containing the NEXT SENTENCE.
Code:
IF A = B
NEXT SENTENCE
ELSE
MOVE C to D
END-IF
DISPLAY "This is NOT the NEXT SENTENCE".
DISPLAY "This IS the NEXT SENTENCE".
In this example, if A equals B then the next statement to be executed after NEXT SENTENCE will be
Code:
DISPLAY "This IS the NEXT SENTENCE",
since this is the first statement after the period terminating the sentence containing the NEXT SENTENCE.
Note: This example does not conform to the ANSI/ISO standard for NEXT SENTENCE, so your compiler may properly complain about the syntax. However, the example does serve to illustrate the point.
Note: NEXT SENTENCE is
not a real statement because it may be used only within other specific statements, most notably the IF statement. Here again, though, some vendors allow a NEXT SENTENCE statement as a nonstandard extension.
Thanks to Bill Klein for corrections regarding standard COBOL.