The EPI must be initialized, by creating a CclEPI object, before a terminal
connection can be made to CICS
®. The CclEPI object, like the CclECI object, also
provides access to information about CICS servers which have been configured
in the
CICS Transaction Gateway configuration
file. The following C++ sample shows the use of the CclEPI object:
#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;
To add a 3270 terminal to CICS, a CclTerminal object is created. The CICS server name
used must be configured in the
CICS Transaction Gateway initialization
file. To start a transaction on the CICS server a CclSession object is required
to control the session. The required transaction (in this example the CICS-supplied
sign-on transaction CESN) can then be started using the
send method
on the CclTerminal object:
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.