The EPI must be initialized, by creating a CclEPI object, before a terminal connection can be made to CICS®.
#include <cicsepi.hpp> // CICS Transaction Gateway EPI headers
…
CclEPI epi; // Initialize CICS Transaction Gateway EPI
// List all CICS servers in Gateway initialization file
for ( int i=1; i<= EPI.serverCount(); i++ )
cout << EPI.serverName(i) << " "
<< EPI.serverDesc(i) << endl;
try {
// Connect to CICS server
CclTerminal terminal( "CICS1234" );
// Start CESN transaction on CICS server
CclSession session( Ccl::sync );
terminal.send( &session, "CESN" );
…
} catch ( CclException &exception ) {
cout << "CclClass exception: " << exception.diagnose() << endl;
}
Note the use of try and catch blocks to handle any exceptions thrown by the CICS classes.