Skip navigation.

ATMI COBOL Function Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader




TPDISCON() - take down a conversational connection






TPDISCON() immediately tears down the connection specified by COMM-HANDLE in TPSVCDEF-REC, the communications handle, and generates a TPEV-DISCONIMM event on the other end of the connection.

TPDISCON() can only be called by the initiator of the conversation. TPDISCON() can not be called within a conversational service on the communications handle with which it was invoked. Rather, a conversational service must use TPRETURN() to signify that it has completed its part of the conversation. Similarly, even though a program communicating with a conversational service can issue TPDISCON(), the preferred way is to let the service tear down the connection in TPRETURN(); doing so ensures correct results. If the initiator of the connection is a server, then TPRETURN() can also be used to cause an orderly disconnection. If the initiator of the connection is in a transaction, then TPCOMMIT() or TPABORT() can be used to cause an orderly disconnection.

TPDISCON() causes the connection to be torn down immediately (that is, abortive rather than orderly). Any data that has not yet reached its destination may be lost. TPDISCON() can be issued even when the program on the other end of the connection is participating in the caller's transaction. In this case, the transaction is aborted. Also, the caller does not need to have control of the connection when TPDISCON() is called.

Return Values

Upon successful completion, TPDISCON() sets TP-STATUS to [TPOK].


Under the following conditions, TPDISCON() fails and sets TP-STATUS to:


COMM-HANDLE is invalid or is the communications handle with which a conversational service was invoked.


This error code indicates that either a timeout has occurred or TPDISCON() has been attempted, in spite of the fact that the current transaction is already marked rollback only.

If the caller is in transaction mode, then either the transaction is already rollback only or a transaction timeout has occurred. The transaction is marked abort-only. (Note that calling TPDISCON() on a connection in the caller's transaction would have resulted in the transaction being marked abort-only, even if TPDISCON() had succeeded.)

If the caller is not in transaction mode, a blocking timeout has occurred. (A blocking timeout can occur only if both TPBLOCK and TPTIME are specified.)

If a transaction timeout has occurred, then, with one exception, any attempts to perform further conversational work, send new requests, or receive outstanding replies will fail with TPETIME until the transaction has been aborted. The exception is a request that does not block, expects no reply, and is not sent on behalf of the caller's transaction (that is, TPACALL() with TPNOTRAN, TPNOBLOCK, and TPNOREPLY set).

When a service fails inside a transaction, the transaction is put into the TX_ROLLBACK_ONLY state. This state is treated, for most purposes, as though it were equivalent to a timeout. All further ATMI calls for this transaction (with the exception of those issued in the circumstances described in the previous paragraph) will fail with TPETIME.


TPDISCON() was called improperly.


A BEA Tuxedo system error has occurred. The exact nature of the error is written to a log file. The communications handle is no longer valid.


An operating system error has occurred. The communications handle is no longer valid.

See Also

TPABORT(3cbl), TPCOMMIT(3cbl), TPCONNECT(3cbl), TPRECV(3cbl), TPRETURN(3cbl), TPSEND(3cbl)


Skip navigation bar  Back to Top Previous Next