Quantcast
Channel: Visual COBOL
Viewing all articles
Browse latest Browse all 5819

Forum Post: missing End-Try swallows tail of program

$
0
0
It appears that in the following managed console program, if there is no run-time exception, "swallows" up the tail end of the program if the End-Try is missing.  There appear to be no warnings, etc., when the program is compiled.    $set checkdiv"ENTCOBOL".     program-id . Program1 as "cblTestTryCatch1.Program1" .    * You can use the CHECKDIV"ENTCOBOL" directive so that you get an division by zero error returned.    * Adding an ON SIZE ERROR would also allow you to handle the error in your code.    * The $set directive shown above accomplishes this.     data division .     working-storage section .     01 Junk Pic X.     01 A Pic 9 value 1.     01 B Pic 9 value 1.     01 C Pic 9 value 2.     procedure division .         Declare Exception1 as type Exception         Try              Compute C = B / A              Display "C = " , C         Catch Exception1              Display Exception1 :: Message    *    End-Try.         Display "End of program..."         Accept Junk         goback .     end program Program1 .

Viewing all articles
Browse latest Browse all 5819

Trending Articles



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