Most class methods could generate an exception.
The default exception handler is found in the handleException method in the CclECI and CclEPI classes. It is a simple routine which does a C++ throw of a CclException object. It does not perform any action if an exception occurs within the destruction of an object. You must not do a throw within a destructor as this causes unpredictable results.
This routine is suitable for most needs when using synchronization modes of dsync and sync. For example:
#include <iostream.h>
#include <cicseci.hpp>
void main(void) {
CclECI *eci;
eci = CclECI::instance();
CclFlow flow(Ccl::sync);
CclBuf buf;
CclConn conn("CICSOS2","SYSAD","SYSAD");
buf.setDataLength(80);
try {
conn.link(flow,"EC01",&buf);
cout << (char *)buf.dataArea() << endl;
}
catch(CclException &exc) {
cout << "link failed" << endl;
cout << "diagnose:" << exc.diagnose() << endl;
cout << "abend code:" << exc.abendCode() << endl;
}
};
void CclECI::handleException(CclException except) {
if (*(except.methodName()) != '~') {
throw( except );
} else {
// Handle a destructor exception, but ensure that this
// routine just returns
}
};