OpenTP1 Version 7 Programming Reference COBOL Language

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

TPACALL - Send a service request

Format

01  TPSVCDEF-REC.
    COPY  TPSVCDEF.
01  TPTYPE-REC.
    COPY  TPTYPE.
01  DATA-REC.
    COPY  Data record definition.
01  TPSTATUS-REC.
    COPY  TPSTATUS.
 
CALL "TPACALL" USING TPSVCDEF-REC TPTYPE-REC
                     DATA-REC  TPSTATUS-REC.

Description

TPACALL sends a request message to the service named by SERVICE-NAME. DATA-REC is the record to be sent and LEN specifies the amount of data in DATA-REC that should be sent. Note that if DATA-REC is a record of a type that does not require a length to be specified, LEN is ignored (and may be 0). If DATA-REC is a record type in which the length must be specified, do not specify 0 in LEN. If REC-TYPE does not have a subtype, SUB-TYPE is ignored (and may be SPACES). If REC-TYPE is SPACES, DATA-REC and LEN are ignored and a request is sent with no data portion, REC-TYPE and SUB-TYPE must match one of the types and sub-types recognized by SERVICE-NAME. Note that for each request sent while in transaction mode, a corresponding reply must ultimately be received.

<<Data areas>>

<<TPSVCDEF-REC

Specify a value indicating the TPACALL operation. The value specified here determines the return value. The specifiable values and their meanings will be explained later.>>

<<TPTYPE-REC

Indicates the record type and subtype record name of the send data.>>

<<DATA-REC

Points to the send data.>>

<<TPSTATUS-REC

Will be assigned the return value indicating the result of TPACALL execution.>>

The valid settings of TPSVCDEF-REC are as follows:

TPNOTRAN
If the caller is in transaction mode and this setting is used, when SERVICE-NAME is invoked, it is not performed on behalf of the caller's transaction. If SERVICE-NAME does not support transactions, 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
If the caller is in transaction mode and this setting is used, when 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.

TPNOREPLY
This setting informs TPACALL that a reply is not expected. When TPNOREPLY is set, the routine returns TPOK on success and sets COMM-HANDLE to 0, an invalid communication handle. When the caller is in transaction mode, this setting cannot be used when TPTRAN is also set. Either TPNOREPLY or TPREPLY must be set.

TPREPLY
This setting informs TPACALL that a reply is expected. When TPREPLY is set, the routine returns TPOK on success and sets COMM-HANDLE to a valid communication handle. When the caller is in transaction mode, this setting must be used when TPTRAN is also set. Either TPNOREPLY or TPREPLY must be set.

TPNOBLOCK
The request is not sent if a blocking condition exists (for example, the internal buffers into which the message is transferred are full). Either TPNOBLOCK or TPBLOCK must be set.

TPBLOCK
When 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
This setting signifies that the caller is willing to block indefinitely and wants to be immune to blocking timeouts. Transaction timeouts may still occur. Either TPNOTIME or TPTIME must be set.

TPTIME
This setting signifies that the caller receives blocking timeouts if a blocking condition exists and the blocking time is reached. Either TPNOTIME or TPTIME must be set.

TPSIGRSTRT
If a signal interrupts any underlying system calls, the interrupted system call is re-issued. Either TPNOSIGRSTRT or TPSIGRSTRT must be set.

TPNOSIGRSTRT
If a signal interrupts any underlying system calls, the interrupted system call is not restarted and the routine fails. Either TPNOSIGRSTRT or TPSIGRSTRT must be set.

Return value

Upon successful completion, TPACALL sets TP-STATUS to TPOK. In addition, if TPREPLY was set in TPSVCDEF-REC, TPACALL returns a valid communication handle in COMM-HANDLE that can be used to receive the reply of the request sent.

Errors

Under the following conditions, TPACALL fails and sets TP-STATUS to one of the values below. Unless otherwise noted, failure does not affect the caller's transaction, if one exists.

TPEINVAL
Invalid arguments were given (for example, settings in TPSVCDEF-REC are invalid).

TPENOENT
Cannot send to SERVICE-NAME because it does not exist.

TPEITYPE
The pair REC-TYPE and SUB-TYPE is not one of the allowed types and sub-types that SERVICE-NAME accepts.

TPELIMIT
The caller's request was not sent because the maximum number of outstanding asynchronous requests has been reached.

TPETRAN
SERVICE-NAME does not support transactions and TPTRAN was set.

TPETIME
A timeout occurred. If the caller is in transaction mode, a transaction timeout occurred and the transaction is marked rollback-only; otherwise, a blocking timeout occurred and both TPBLOCK and TPTIME were specified. If a transaction timeout occurred, any attempts to send new requests or receive outstanding replies fail with TPETIME until the transaction has been rolled back.

TPEBLOCK
A blocking condition exists and TPNOBLOCK was specified.

TPEGOTSIG
A signal was received and TPNOSIGRSTRT was specified.

TPEPROTO
TPACALL was called in an improper context.

TPESYSTEM
A communication resource manager system error has occurred. The exact nature of the error is determined in a product-specific manner.

TPEOS
An operating system error has occurred. The exact nature of the error is determined in a product-specific manner.

See also

TPCALL, TPCANCEL, TPGETRPLY

<<Notes on use with OpenTP1>>

  1. <<The value TPNOBLOCK is invalid under the relevant version of the OpenTP1. Therefore, the error code TPEBLOCK will not be returned to TP-STATUS. The OpenTP1 is designed so that if communication is impossible because of blocking, TPESYSTEM is returned as when communication is impossible because of network failure.>>
  2. <<The value TPNOTIME is invalid under the relevant version of the OpenTP1.>>
  3. <<The value TPSIGRSTRT is invalid. Regardless of whether this value is set, when a signal is received, the interrupted system call is reinvoked. TPEGOTSIG will never return.>>
  4. <<Under the relevant version of the OpenTP1, TPEITYPE will not return. If a record of a type unavailable with SERVICE-NAME is passed, the function TPACALL normally returns, but TPESYSTEM or TPESVCERR will return when the function TPGETRPLY is called. Therefore, the error condition is identified. If the calling program is in transaction mode, the rollback_only state comes into effect.>>
  5. <<Under the OpenTP1, when a process encounters transaction timeout, it terminates abnormally. Therefore, TPETIME returns only when blocking timeout occurs.>>
  6. <<Under the relevant version of the OpenTP1, a record which requires rollback causes the return of TPESYSTEM unless otherwise specified by the X/Open. However, the rollback_only state may not come into effect even when TPESYSTEM returns.>>
  7. <<Under the relevant version of the OpenTP1, TPELIMIT will not return.>>
  8. <<For OSI TP communication using the TP1/NET/OSI-TP-Extended, the length of the send data must not exceed the value assigned to the length operand of the NET buffer group definition (nettbuf) contained in the NET/Library common definition.>>