Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

Unhandled Errors

$
0
0

As we migrate from a mainframe to Visual COBOL, we are concerned that programs currently aborting with unhandled exceptions will complete without any indication of an error. Here are a couple examples of errors that don’t stop the program with an error message like they do on the mainframe:

 

      Divide by zero

       program-id. Program1 as "Project1.Program1".

       data division.

       working-storage section.

       01 NUMERATOR    PIC 9.

       01 DENOMINATOR  PIC 9.

       01 QUOTIENT     PIC 9.

       procedure division.

           MOVE 1      TO NUMERATOR.

           MOVE ZERO   TO DENOMINATOR.

           COMPUTE QUOTIENT = NUMERATOR / DENOMINATOR.

       end program Program1.

 

       Spaces in a numeric field

       program-id. Program2 as "Project1.Program2".

       data division.

       working-storage section.

       01 GROUP-LEVEL.

          02 NUMERIC-FIELD    PIC 9.

       procedure division.

           MOVE SPACES TO GROUP-LEVEL.

           ADD 1       TO NUMERIC-FIELD.

       end program Program2.

 

 

This example stops the program as we expected the others to:

       program-id. Program3 as "Project1.Program3".

       data division.

       working-storage section.

       01 TBL PIC X OCCURS 3 TIMES INDEXED BY i.

       procedure division.

           SET i TO 4.

           DISPLAY TBL(i) UPON CONSOLE.

       end program Program3.

 

Is there a Visual COBOL configuration that can stop processing on all three of these errors?


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>