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.

Editorial / Best Answer

Answered by: 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.

Showing Answers 1 - 5 of 5 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.

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.  
 
I think this explanation will clear your doubt

Ningayya

  • Nov 26th, 2008
 

                        NEXT SENTANCE                                     CONTINUE

after the condition,the control goes
 to next period(.).

ex:
         IF A > B

             NEXT SENTENCE

          END-IF
           DISPLAY 10
           DISPLAY 20.
           DISPLAY 30.

 It will display only 30

  Was this answer useful?  Yes

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

  Was this answer useful?  Yes

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.

  Was this answer useful?  Yes

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.

  Was this answer useful?  Yes

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.

  Was this answer useful?  Yes

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions