Previous Topic Next topic Print topic


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
		

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 the Java Run-time Class Library Reference, which is in help\mfcobol.docs.zip in your COBOL development system installation.

Previous Topic Next topic Print topic