×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

COBOL General discussion FAQ

NEXT SENTENCE vs CONTINUE

What is NEXT SENTENCE? by k5tm
Posted: 26 Apr 02 (Edited 14 Nov 03)

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.

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 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.

Back to COBOL General discussion FAQ Index
Back to COBOL General discussion Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close