Throwing Exceptions from COBOL

Restriction: This applies to native code only.

You can throw a Java exception from your COBOL code. The exception object can be any Java class.

The javasup class provides two methods for throwing exceptions, namely: throwException and throwNewException. You use these methods as follows:

invoke javasup "throwException" using aCOBOLProxy
invoke javasup "throwNewException" using javaclassdescription


is a COBOL proxy to any Java object of type Throwable.
is the name of the class of Java exception to throw.
is a text description of the exception.

For details of the javasup class and its methods, see the Java Run-time Class Library Reference, which is in docs/ in your COBOL development system installation.