Skip to main content

The NEXT SENTENCE statement

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

My program is :

          77 A PIC 9 VALUE 5.

          IF A > 0

           IF A = 5

            NEXT SENTENCE

           ELSE

              DISPLAY "1"

            END-IF

              DISPLAY "2"

            ELSE

              DISPLAY "3"

            END-IF

              DISPLAY "4"

              DISPLAY "5".

              DISPLAY "The period is before"

            STOP RUN.

Only the  message 'period is before' is displayed .  Why ?

Resolution:

As it is defined in the documentation :

'The NEXT SENTENCE statement redirects the flow of execution to the logically next COBOL verb following the next period'

When the compiler directive -C OLDNEXTSENTENCE is specified, NEXT SENTENCE behaves like CONTINUE  

Old KB# 2276