Previous Topic Next topic Print topic


Throwing Exceptions from COBOL

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

where:

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

For details of the javasup class and its methods, see your Java Run-time Class Library Reference.

Previous Topic Next topic Print topic