![]() |
![]() |
|
|
Establishing a Connection
The TPCONNECT(3cbl) routine sets up a conversation.
Use the following signature to call the TPCONNECT routine.
01 TPSVCDEF-REC.
COPY TPSVCDEF.
01 TPTYPE-REC.
COPY TPTYPE.
01 DATA-REC.
COPY User Data.
01 TPSTATUS-REC.
COPY TPSTATUS.
CALL "TPCONNECT" USING TPSVCDEF-REC TPTYPE-REC DATA-REC TPSTATUS-REC.
Refer to Defining a Service for more information on the TPSVCDEF-REC record, and to Defining Typed Records for more information on the TPTYPE-REC record.
At the same time the connection is being established, data can be sent through the DATA-REC with the length of the data specified by LEN IN TPTYPE-REC. The REC-TYPE and SUB-TYPE of the data in DATA-REC must be types recognized by the service being called. If no data is being sent, the value of REC-TYPE is SPACES, and DATA-REC and LEN are ignored.
The BEA Tuxedo system returns a communication handle, COMM-HANDLE IN TPSVCDEF-REC, when a connection is established with TPCONNECT or TPSVCSTART. COMM-HANDLE is used to identify subsequent message transmissions with a particular conversation. A client or conversational service can participate in more than one conversation simultaneously. The maximum number of simultaneous conversations is 64.
In the event of a failure, TPCONNECT sets TP-STATUS to the appropriate error condition. For a list of possible error codes, refer to TPCONNECT(3cbl) in the BEA Tuxedo COBOL Function Reference.
The following example shows how to use the TPCONNECT routine.
Establishing a Conversational Connection
. . .
* Prepare the record to send
MOVE "HELLO" TO DATA-REC.
MOVE 5 TO LEN.
MOVE "STRING" TO REC-TYPE.
*
SET TPBLOCK TO TRUE.
SET TPNOTRAN TO TRUE.
SET TPNOTIME TO TRUE.
SET TPSIGRSTRT TO TRUE.
SET TPSENDONLY TO TRUE.
*
CALL "TPCONNECT" USING TPSVCDEF-REC
TPTYPE-REC
DATA-REC
TPSTATUS-REC.
IF NOT TPOK
error processing ...
ELSE
COMM-HANDLE is valid.
![]() |
![]() |
![]() |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|