Skip to main content

Problem:

It is generally considered good practice in COBOL to use explicit scope termination statements such as END-IF and END-EVALUATE.

Resolution:

Using the IMPLICTSCOPE directive to accomplish this. The program:-

      $set NOIMPLICITSCOPE WARNING(3)

       working-storage section.

       01  ws-data         pic x(10).

       procedure division.

       start-section section.

           evaluate true

               when ws-data = "hhh"

                   continue

               when other

                   display "Hello"

           if ws-data = 1

               display "Hello World"

           goback.

will compile with errors as it enforces explicit scope statements. However removing the $SET line of the program then the program will compile clean and run.

However it would be considered good practice for END-EVALUATE and END-IF to have been used in the above program.

Old KB# 4401