Dear friend the difference between the next and continue verb is that in the continue verb it is used for a situation where there in no eof condition that is the records are to be accessed again and again in an file , whereas in the next verb the indexed file is accessed sequentially ,hence when index clase is accessed sequentially read next record command is used,i hope that is satisfactory.
A CONTINUE statement is a statement which has no effect on the execution of the program. It is most useful within a conditional phrase of another statement when no action is desired when the condition occurs. Since CONTINUE has no effect on execution, it exists merely to keep the compiler happy in situations where the compiler expects (demands?) a statement.
NEXT SENTENCE is not a statement at all, but rather a phrase that can be substituted for a statement in a few limited places, most notably the IF statement. Notice also that it is NEXT SENTENCE; execution control is transferred to the next execuatable sentence. A sentence is a sequence of one or more statements terminated by the period separator (aka full stop). So, when you see NEXT SENTENCE, scan until you find a period separator; execution will begin with the next statement after the period separator - the first statement of the next sentence.
Tom Morrison
"Dear friend the difference between the next and continue verb is that in the continue verb it is used for a situation where there in no eof condition that is the records are to be accessed again and again in an file , whereas in the next verb the indexed file is accessed sequentially ,hence when index clase is accessed sequentially read next record command is used,i hope that is satisfactory."
This is completely inaccurate. You are confusing the NEXT in READ ... NEXT with NEXT SENTENCE, which is a totally different usage.
Essentially, CONTINUE causes a transfer of control to the first logical statement after the relevant scope delimiter (or period), and NEXT SENTENCE causes a transfer of control the the first logical statement after the next period.
Note that NEXT SENTENCE can only be used in IF and SEARCH statements, and has been declared "archaic" by the COBOL Standards Committee. This means it will eventually be deleted from the language.
Stephen J Spiro
Member, ANSI COBOL Standards Committee
Claude, back in the days when everybody coded periods, next sentence would have been the same as continue (if it existed!). Nowadays, they are VERY different. Consider:
IF A = B
CONTINUE
ELSE
DISPLAY 'Hello'
END-IF
DISPLAY 'GOT HERE'
DISPLAY 'AND HERE'
.
EXIT-PARA.
EXIT.
If A equals B then GOT HERE and AND HERE will be displayed.
Whereas:
IF A = B
NEXT SENTENCE
ELSE
DISPLAY 'Hello'
END-IF
DISPLAY 'GOT HERE'
DISPLAY 'AND HERE'
.
EXIT-PARA.
EXIT.
If A does equal B, it will drop thru to the next period ie GOT HERE AND HERE will not be displayed. In legacy coding. you can expect to find a period after the END-IF, and in this case the effect of the two statements would be the same.
Basically, BE VERY CAREFUL WITH NEXT SENTENCE !!!! It can miss huge chunks of code as it will begin processing at the statement following the next period. In programs with one period at the end of the section, then statement would drop thru to the end of the section!!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.