TPDISCON - take down a conversational connection
01 TPSVCDEF-REC. COPY TPSVCDEF. 01 TPSTATUS-REC. COPY TPSTATUS. CALL "TPDISCON" USING TPSVCDEF-REC TPSTATUS-REC.
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(3cbl) 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(3cbl); doing so ensures correct results. If the initiator of the connection is a server, then TPRETURN(3cbl) can also be used to cause an orderly disconnection. If the initiator of the connection is in a transaction, then TPCOMMIT(3cbl) or TPABORT(3cbl) 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.
Upon successful completion, TPDISCON sets TP-STATUS to [TPOK].
Under the following conditions, TPDISCON fails and sets TP-STATUS to:
TPABORT(3cbl),
TPCOMMIT(3cbl),
TPCONNECT(3cbl),
TPRECV(3cbl),
TPRETURN(3cbl),
TPSEND(3cbl)