TPCONNECT-establish a conversational connection
01TPSVCDEF-REC.
COPY TPSVCDEF.
01TPTYPE-REC.
COPY TPTYPE.
01DATA-REC.
COPY User data.
01TPSTATUS-REC.
COPY TPSTATUS.
CALL "TPCONNECT" USINGTPSVCDEF-RECTPTYPE-RECDATA-RECTPSTATUS-REC.
TPCONNECT allows a program to set up a half-duplex connection to a conversational service, SERVICE-NAME in TPSVCDEF-REC. The name must be one of the conversational service names posted by a conversational server.
As part of setting up a connection, the caller can pass application defined data to the receiving service routine. If the caller chooses to pass data, then DATA-REC contains the data and LEN in TPTYPE-REC specifies how much of the record to send. Note that if DATA-REC is a record of a type that does not require a length to be specified, then LEN is ignored (and may be 0). If REC-TYPE in TPTYPE-REC is SPACES, DATA-REC and LEN are ignored (no application data is passed to the conversational service). REC-TYPE and SUB-TYPE in TPTYPE-REC must match one of the types and sub-types recognized by SERVICE-NAME.
Because the conversational service receives DATA-REC and LEN upon successful return from TPSVCSTART(), the service does not call TPRECV() to get the data sent by TPCONNECT.
Following is a list of valid settings in TPSVCDEF-REC.
TPNOTRAN
SERVICE-NAME is invoked, it is not performed on behalf of the caller's transaction. If SERVICE-NAME belongs to a server that does not support transactions, then this setting must be used when the caller is in transaction mode. A caller in transaction mode that uses this setting is still subject to the transaction timeout (and no other). If a service fails that was invoked with this setting, the caller's transaction is not affected. Either TPNOTRAN or TPTRAN must be set.
TPTRAN
SERVICE-NAME is invoked, it is performed on behalf of the caller's transaction. This setting is ignored if the caller is not in transaction mode. Either TPNOTRAN or TPTRAN must be set.
TPSENDONLY
TPSENDONLY or TPRECVONLY must be specified.
TPRECVONLY
TPSENDONLY or TPRECVONLY must be specified.
TPNOBLOCK
TPNOBLOCK or TPBLOCK must be set.
TPBLOCK
TPBLOCK is specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout). Either TPNOBLOCK or TPBLOCK must be set.
TPNOTIME
TPNOTIME or TPTIME must be set.
TPTIME
TPNOTIME or TPTIME must be set.
TPSIGRSTRT
TPNOSIGRSTRT or TPSIGRSTRT must be set.
TPNOSIGRSTRT
TPNOSIGRSTRT is specified and a signal is received, the call fails and TP-STATUS is set to TPGOTSIG. Either TPNOSIGRSTRT or TPSIGRSTRT must be set.
Upon successful completion, TPCONNECT sets TP-STATUS to [TPOK] and returns a communications handle in COMM-HANDLE in TPSVCDEF-REC that is used to refer to the connection in subsequent calls.
Under the following conditions, TPCONNECT fails and sets TP-STATUS to (unless otherwise noted, failure does not affect the caller's transaction, if one exists).
TPEINVAL]
TPSVCDEF-REC are invalid).
TPENOENT]
SERVICE-NAME because it does not exist or is not a conversational service.
TPEITYPE]
REC-TYPE and SUB-TYPE is not one of the allowed types and sub-types that SERVICE-NAME accepts.
TPELIMIT]
TPETRAN]
SERVICE-NAME belongs to a program that does not support transactions and TPNOTRAN was not set.
TPETIME]
TPBLOCK and TPTIME were specified. If a transaction timeout occurred, then any attempts to send or receive messages on any connections or to start a new connection will fail with [TPETIME] until the transaction has been aborted.
TPEBLOCK]
TPNOBLOCK was specified.
TPGOTSIG]
TPSIGRSTRT was not specified.
TPEPROTO]
TPCONNECT was called in an improper context.
TPESYSTEM]
TPEOS]
TPDISCON(), TPRECV(), TPSEND()