You are here:

Cobol/Continue vs Next Sentence

Advertisement


Question
What exactly is the difference between CONTINUE and NEXT SENTENCE? Is there a best time to use one over the other?

Answer
If you put a period at the end of every logical IF statement in place of an END-IF, they work almost the same. But if you write block structured code where you embed IFs and various other statements with a '.' only befor the next paragraph label the difference is major. (see below)
IF condition0
 continue     <== [this continue work like a next sentence ]
else
 if contition2
   do....
 else
   do....
 end-if
 if condition3
   continue    <== [this continue takes you to the 'do' after the end-if]
 else
   do-----
 end-if
 do ------     <= [2nd continue begin here]
end-if
.
[This is where all NEXT SENTENCE statments will begin regardless of level of nested 'IF' they are in.]

Hope this helps.
David  

Cobol

All Answers


Answers by Expert:


Ask Experts

Volunteer


David Nelson

Expertise

I specialize in IBM z/OS COBOL and MicroFocus OCDS and Server Express non-OOP. Design, coding and performance oriented questions. Also linking to IBM Assembler from COBOL. Because the rules change with version, please state language level, version and platform environment. See CICS for questions about CICS.

Experience

Over 35 years working with COBOL on multiple platforms and OS.

Education/Credentials
Graduate, New York School of Computer Technology.

Past/Present Clients
Major Financial Institutions, State of NC (DHHS), Manufacturing, Financial services, Warehousing, Software developer and others.

©2012 About.com, a part of The New York Times Company. All rights reserved.