Client applications can
control whether ATI transactions are allowed by using the setATI()
and queryATI() methods on the CclTerminal class.
The default setting is for ATIs to be disabled. The following code
fragment shows how to enabled ATIs for a particular terminal:
// Create terminal connection to CICS server
CclTerminal terminal( "myserver" );
// Enable ATIs
terminal.setATI(CclTerminal::enabled);
The CclTerminal class performs one or more of the following
- Run any outstanding ATIs as soon as a transaction ends
- Call additional programming needed to handle the ATI replies
- Run ATIs before or between client-initiated transactions
depending on whether the call synchronization type is Synchronous,
Asynchronous or Deferred synchronous.
- Synchronous
- When you call the CclTerminal send() method, any
outstanding ATIs will be run after the client-initiated transaction
has completed. The CclTerminal class will wait for the ATI replies
then update the CclScreen contents as part of the synchronous
send() call. If you expect an ATI to occur before or between client-initiated
transactions, you can call the CclTerminal receiveATI() method
to wait synchronously for the ATI.
- Asynchronous
- When the client application calls the CclTerminal send()
method for an async session, the CclTerminal class starts a
separate thread to handle replies. If ATIs are disabled, this thread
finishes when the CICS® transaction is complete. If
ATIs are enabled, the reply thread continues to run between transactions.
When the CclTerminal state becomes idle, any outstanding ATIs
are run and ATIs received subsequently are run immediately. The reply
thread is not started until the first CclTerminal::send() call,
so if you expect ATIs to occur before any client-initiated transactions,
you can call the receiveATI() method to start the reply thread.
- Deferred synchronous
- After the CclTerminal send() method is called for
a dsync session, the poll() method is used to receive the replies.
Outstanding ATIs are started when the last reply has been received
(that is, on the final poll() call). You can also call
the poll() method to start and receive replies for ATIs between client-initiated
transactions. As the poll() method can be called before or between
client-initiated transactions, the receiveATI() method is not needed
(and is invalid) for deferred synchronous sessions. For any of the
synchronization types you can provide a handleReply() method by subclassing
the CclSession class. As for client-initiated transactions, this method
will be called when the ATI 3270 data has been received and the CclScreen
object updated. The transID() method on the CclTerminal or CclSession
can be called to identify the ATI.