What is the difference between NEXT SENTENCE and CONTINUE?
NEXT SENTENCE gives control to the verb following the next period. CONTINUE gives control to the next verb after the explicit scope terminator. (This is not one of COBOL II's finer implementations). It's safest to use CONTINUE rather than NEXT SENTENCE in COBOL II.
it will display 1 2 3. if a>b. let me know if it is not correct.
Showing Answers 1 - 11 of 11 Answers
chandrasekaran
Jun 22nd, 2006
can it be explained with the coding given below
IF NOT INPUT-EOF IF INPUT-REC-TYPE = '55' PERFORM 2100-PROCESS-WTN ELSE NEXT SENTENCE/CONTINUE END-IF ADD +1 TO INPUT-COUNT. What will be the result for an next sentence or an continue
umapathi
Jul 20th, 2006
the following code explains u clearly
If A>B
next sentence
end-if
display 1
display 2.
display 3.
it will display only 3. if a>b
if a>b
continue
end-if
display 1
display 2.
display 3.
it will display 1 2 3. if a>b. let me know if it is not correct.
While we are using the CONTINUE statement within the nested scope, where the program control goes? To immediate next scope terminator or the outer most scope terminator?
Jeena John
Oct 25th, 2007
According to this code If "Next sentence" is given the control wil go to the statement after "ADD +1 TO INPUT-COUNT"(control will go to verb following the next period).
If "continue "is given control will go to this statement "ADD +1 TO INPUT-COUNT" (control will go to the next verb after the Explicit scope terminator that is after end-if).
A scope terminator brackets its preceding verb, eg. IF .. END-IF, so that all statements between the verb and its scope terminator are grouped together. Other common COBOL II verbs are READ, PERFORM, EVALUATE, SEARCH and STRING.
Next sentence: The sentence is the collection of statements and is always end with period(.).so next sentence means the control passes to next sentence after period. e.g.: if X=3
Compute X=X-3 Next sentence End-if move X to Y. move 10 to Y.
Then output is: move 10 to Y. Continue: Transfer the control after the end scope terminator.
E.g: in above example if we use "continue" in place of "next sentence" output is: move X to Y
CONTINUE: Whatever the sentences we have first it will focus on the Scope terminators or any conditions then only it will do other.
NEXT: How many controls we had but it will focus only where is the next step after the Period (.).
sibhi
Aug 9th, 2011
the following code explains u clearly
If A>B
next sentence
end-if
display 1
display 2.
display 3.
it will display only 3. if a>b
if a>b
continue
end-if
display 1
display 2.
display 3.
it will display 1 2 3. if a>b.
Claudio Neto
Aug 10th, 2016
With NEXT SENTENCE, 1 will not be added to INPUT-COUNT, because it will search for the sentence after period. CONTINUE will add 1 to INPUT-COUNT.
Amit
Jan 17th, 2017
When NEXT SENTENCE is coded, Program will not add +1 to INPUT-COUNT.
When CONTINUE is coded, +1 will be added to INPUT-COUNT.
Prasanth Karthikeyan
Sep 14th, 2018
Continue pushes the control to Add +1 to Input-count. Say if Input-count was 0 then the value will be iterated to 1 Next sentence will never add +1 to Input-count it will bypass the command. Say if Input-count was 0 then the value will remain same.
What is the difference between NEXT SENTENCE and CONTINUE?
Editorial / Best Answer
Answered by: umapathi
the following code explains u clearly
If A>B
next sentence
end-if
display 1
display 2.
display 3.
it will display only 3. if a>b
if a>b
continue
end-if
display 1
display 2.
display 3.
it will display 1 2 3. if a>b. let me know if it is not correct.
Related Answered Questions
Related Open Questions