Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

MODULE 7: COBOL Control statements


COBOL Jump statement

  • COBOL supports three jump statements:- CONTINUE, NEXT SENTENCE, GO TO.
  • These statements transfer control to another part of your program
  • Below we provided overview of each those statements but it is explained in detail in next section

CONTINUE statement

  • CONTINUE is introduced in COBOL-85
  • It is a dummy statement and does no operation. This is mostly used in a conditional statement or an imperative statement to just exit without doing any operation
  • CONTINUE is indication that there is no statements to be executed for this path
  • CONTINUE just passes control to next immediate statement without doing any operation
  • CONTINUE statement is described in details here < link >

NEXT SENTENCE

  • “NEXT STENETECE” is used to transfer control to the next sentence. As you already know multiple COBOL statements are combined to form a sentence and sentence is terminated by period (.)
  • CONTINUE statement is used to do nothing and just passes control to next statement (whereas NEXT SENTENCE passes control to next sentence)
  • NEXT SENTENCE also does nothing, it just transfer control to next statement after the nearest period(.) which marks the end of current sentence
  • NEXT SENTENCE statement is described in details here < link >

GO TO statement

  • GO TO is used to unconditionally and permanently transfer control to another paragraph of program
  • When we use PERFORM, specified paragraph executes and control is transferred back to the next statement following PERFORM. But when we use GO TO, specified paragraph will be executed but control will NOT be returned back
  • GO TO statement is described in details here < link >






© copyright mainframebug.com
Privacy Policy