COBOL Next Sentence vs COBOL Continue Statement. COBOL Tutorial.
Welcome to today’s session on Next Sentence in COBOL and Continue statement in COBOL. In this session, you’ll get an overview of COBOL Next Sentence Verb and COBOL Continue Statement. You’ll learn the difference between COBOL continue and next sentence in COBOL. Let’s get started.
Introduction.
A COBOL program consists of three logical statements (i.e. sequence, selection and iteration statements). There is only one point of entry and one exit for each logical structure.
COBOL PERFORM..UNTIL Statement are used for Iteration. COBOL EVALUATE and COBOL IF-ELSE statement is used for selection. Finally, COBOL PERFORM statements are generally used for sequencing.
COBOL Next Sentence.
NEXT SENTENCE in COBOL, simply passes control to the next executable statement after the next period (i.e. “.” — dot). IBM COBOL next sentence statement is not used very often these days. In fact, you’ll still find COBOL next sentence in an old COBOL program.
In case the NEXT SENTENCE in COBOL is specified with END-IF statement, then control does not pass to the statement following the END-IF. However, control passes to the statement after the closest following period.
COBOL Next Sentence Syntax.
The syntax of the Next Sentence in COBOL is pretty simple and straight forward.
IF condition-1 THEN
{statement-1 .. | NEXT SENTENCE}
.IF condition-1 THEN
{statement-1 ..}
ELSE
{statement-1 ..} | NEXT SENTENCE}
.
COBOL Next Sentence Example.
In the following example, the control will transfer after the period.
Next Sentence Example in COBOL.
In the following example, the control will transfer after the period instead of END-IF.
COBOL Continue Statement.
Continue statement in COBOL, is used to transfer control implicitly within the paragraph or section. COBOL CONTINUE statement is a no-operation statement and it does not have any effect on the execution of the program.
COBOL continue statement indicates that no executable instruction is present, and control will be transfer control to the next executable instruction after an explicit scope terminator (i.e. END-IF etc.).
COBOL CONTINUE Statement Syntax.
The syntax of the Continue statement in COBOL is pretty simple and straight forward.
IF condition-1 THEN
{ statement-1 ... | CONTINUE }
ELSE
{ statement-2 … | CONTINUE }
END-IF.
COBOL Continue Statement Example.
In the following example, the control will transfer after the END-IF.
Continue Statement in COBOL Example.
In the following example, the control will transfer after the period instead of END-IF.
COBOL CONTINUE vs NEXT SENTENCE.
In general, both NEXT SENTENCE in COBOL and CONTINUE in COBOL simply transfer control to the next executable statement. But, the only difference is that COBOL Continue statement to transfer control after explicit scope terminator and COBOL Next sentence transfer control after the period “.”.
Topictrick Youtube Channel.
Today’s COBOL Tutorial story is linked with COBOL continue Vs COBOL Next Sentence Tutorial. Please do watch this video for better understanding and do subscribe to our channel for more such videos.
Please Subscribe to Topictrick & Don’t forget to press THE BELL ICON to never miss any updates. Please visit below mention the link to stay connected with Topictrick.
► Topictrick.com
► Youtube
► Follow us on Twitter
► Facebook
► Linkedin
► Reddit
► Mainframe Blog
Thank you for your support.
Topictrick™
Originally published at https://mainframe-forum.blogspot.com.