OpenTP1 Version 7 TP1/Client User's Guide TP1/Client/W, TP1/Client/P

[Contents][Index][Back][Next]

2.7.1 Interactive service

Organization of this subsection
(1) Establishing connection
(2) Sending data
(3) Receiving data
(4) Disconnecting the connection
(5) Forcibly disconnecting the connection
(6) Generating a transaction
(7) Operating with the OpenTP1 dc_rpc_call_s function

(1) Establishing connection

The CUP establishes connection with the interactive service by issuing the tpconnect function. The UAP process that has established connection by the tpconnect function is called an originator. The other UAP process at the end of connection is called a subordinator.

The descriptor that identifies the established connection is returned upon normal termination of the tpconnect function. Set this descriptor for each of the functions used during the communication.

Issuing the tpreturn function to terminate processing under the interactive service disconnects the connection.

The flags argument of the tpconnect function allows you to specify whether to give control. A process specified to have control can issue the tpsend function to send data. The process specified to have no control passes control to the remote process in communication. The process that calls the tpconnect function can issue the tprecv function to receive data.

(2) Sending data

Issue the tpsend function for sending data. To issue this function, the descriptor returned by the tpconnect function must be set in the argument to specify which connection is to be used.

Only the process that has control of connection can issue the tpsend function. The tpsend function issued by the process that has no control will return an error.

If you want to pass control of connection to the remote process, specify the tpsend function argument.

(3) Receiving data

Issue the tprecv function for receiving data. Data is received asynchronously. Only a process that has no control of connection can issue the tprecv function.

You can specify the argument to have the tprecv function wait for receiving data. When the process that calls the tprecv function is under a transaction, the maximum waiting time is the value specified in the DCCLTTREXPTM of the client environment definition or in the trn_expiration_time operand of the client service definition. In this case, the CUP execution process terminates abnormally when the maximum waiting time is expired; the tprecv function does not return an error.

When the process that calls the tprecv function is not under a transaction, the maximum waiting time is the value specified in the watch_time operand of the client service definition. In this case, the tprecv function returns an error when the maximum waiting time is expired.

(4) Disconnecting the connection

After termination of the interactive service, issuing the tpreturn function disconnects the connection normally. Connection may also be disconnected if a communication error occurred.

(5) Forcibly disconnecting the connection

Issue the tpdiscon function for forcibly disconnecting the connection. The descriptor set in the tpdiscon function is no longer effective in processing. The transaction is rolled back.

(6) Generating a transaction

Issue the dc_trn_begin_s function for generating a transaction by the CUP that uses the XATMI interface for communication.

Table 2-4 shows when a transaction is generated.

Table 2-8 Transaction generation time

The dc_clt_connect_s function is issued. The dc_clt_connect_s function is not issued.
The tpconnect function is issued. The tpconnect function is not issued. The tpconnect function is issued. The tpconnect function is not issued.
Y Y Y No

Legend:
Y: A transaction can be generated and communication with the interactive service via the XATMI interface is available.
No: A transaction can be generated, but communication with the interactive service via the XATMI interface is unavailable.

(7) Operating with the OpenTP1 dc_rpc_call_s function

The dc_rpc_call_s function can still be issued after the tpconnect function has established connection with the interactive service.

The following figure shows the communication mode of the interactive service.

Figure 2-33 Communication mode of interactive service

[Figure]