TPCALL-routine to send a message to a service synchronously
01TPSVCDEF-REC.
COPY TPSVCDEF.
01ITPTYPE-REC.
COPY TPTYPE.
01IDATA-REC.
COPY User data.
01OTPTYPE-REC.
COPY TPTYPE.
01ODATA-REC.
COPY User data.
01TPSTATUS-REC.
COPY TPSTATUS.
CALL "TPCALL" USINGTPSVCDEF-RECITPTYPE-RECIDATA-RECOTPTYPE-RECODATA-RECTPSTATUS-REC.
TPCALL sends a request and synchronously awaits its reply. A call to this routine is the same as calling TPACALL() immediately followed by TPGETRPLY(). TPCALL sends a request to the request/response service named by SERVICE-NAME in TPSVCDEF-REC. The request is sent out at the priority defined for SERVICE-NAME unless overridden by a previous call to TPSPRIO(). The data portion of a request is specified by IDATA-REC and LEN in ITPTYPE-REC specifies how much of IDATA-REC to send. Note that if IDATA-REC is a record of a type that does not require a length to be specified, then LEN in ITPTYPE-REC is ignored (and may be 0). If REC-TYPE in ITPTYPE-REC is SPACES, IDATA-REC and LEN in ITPTYPE-REC are ignored and a request is sent with no data portion. If REC-TYPE in ITPTYPE-REC is STRING and LEN in ITPTYPE-REC is 0, then the request is sent with no data portion. The REC-TYPE in ITPTYPE-REC and SUB-TYPE in ITPTYPE-REC must match one of the REC-TYPEs and SUB-TYPEs recognized by SERVICE-NAME.
ODATA-REC specifies where a reply is read into, and, on input LEN in OTPTYPE-REC indicates the maximum number of bytes that should be moved into ODATA-REC. If the same record is to be used for both sending and receiving, ODATA-REC should be REDEFINED to IDATA-REC. Upon successful return from TPCALL, LEN in OTPTYPE-REC contains the actual number of bytes moved into ODATA-REC. REC-TYPE and SUB-TYPE in OTPTYPE-REC contain the replies type and sub-type respectively. If the reply is larger than ODATA-REC, then ODATA-REC will contain only as many bytes as will fit in the record. The remainder of the reply is discarded and TPCALL sets TPTRUNCATE.
If LEN in OTPTYPE-REC is 0 upon successful return, then the reply has no data portion and ODATA-REC was not modified. It is an error for LEN in OTPTYPE-REC to be 0 on input.
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 the 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 sets this to true 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. The setting is ignored if the caller is not in transaction mode. Either TPNOTRAN or TPTRAN must be set.
TPNOCHANGE
ODATA-REC is not allowed to change. That is, the type and sub-type of the replied record must match REC-TYPE IN OTPTYPE-REC and SUB-TYPE IN OTPTYPE-REC, respectively, so long as the receiver recognizes the incoming record type. Either TPNOCHANGE or TPCHANGE must be set.
TPCHANGE
REC-TYPE IN OTPTYPE-REC and SUB-TYPE IN OTPTYPE-REC, respectively, so long as the receiver recognizes the incoming record type. Either TPNOCHANGE or TPCHANGE must be set.
TPNOBLOCK
TPCALL: the routine may block waiting for the reply. Either 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 or TPSIGRSTRT must be set.
Upon successful completion, TPCALL sets TP-STATUS to [TPOK]. When TP-STATUS is set to TPOK or TPESVCFAIL, APPL-RETURN-CODE IN TPSTATUS-REC contains an application defined value that was sent as part of TPRETURN().
If the size of the incoming message was larger then the size specified in LEN on input, TPTRUNCATE is set and only LEN amount of data was moved to ODATA-REC, the remaining data is discarded.
Under the following conditions, TPCALL fails and sets TP-STATUS to (unless otherwise noted, failure does not affect the caller's transaction, if one exists):
TPEINVAL]
SERVICE-NAME is SPACES or settings in TPSVCDEF-REC are invalid).
TPENOENT]
SERVICE-NAME because it does not exist or is not a request/response service (that is, it is a conversational service).
TPEITYPE]
REC-TYPE and SUB-TYPE is not one of the allowed types and sub-types that SERVICE-NAME accepts.
TPEOTYPE]
TPNOCHANGE was set and the REC-TYPE and SUB-TYPE in ODATA-REC do not match the type and sub-type of the reply sent by the service. Neither ODATA-REC nor LEN in OTPTYPE-REC are changed. If the service request was made on behalf of the caller's current transaction, then the transaction is marked abort-only since the reply is discarded.
TPETRAN]
SERVICE-NAME belongs to a server that does not support transactions and TPTRAN was set.
TPETIME]
TPBLOCK and TPTIME were specified. In either case, neither ODATA-REC nor OTPTYPE-REC are changed. If a transaction timeout occurred, then with one exception, any attempts to send new requests or receive outstanding replies will fail with TPETIME until the transaction has been aborted.
TPESVCFAIL]
TPRETURN() with TPFAIL. This is an application-level failure. The contents of the service's reply, if one was sent, is available in ODATA-REC. If the service request was made on behalf of the caller's current transaction, then the transaction is marked abort-only. Note that so long as the transaction has not timed out, further communication may be performed before aborting the transaction and that any work performed on behalf of the caller's transaction will be aborted upon transaction completion (that is, for subsequent communication to have any lasting effect, it should be done with TPNOTRAN set).
TPESVCERR]
TPRETURN() (for example, bad arguments were passed). No reply data is returned when this error occurs (that is, neither ODATA-REC nor OTPTYPE-REC are changed). If the service request was made on behalf of the caller's transaction (that is, TPNOTRAN was not set), then the transaction is marked abort-only. Note that so long as the transaction has not timed out, further communication may be performed before aborting the transaction and that any work performed on behalf of the caller's transaction will be aborted upon transaction completion (that is, for subsequent communication to have any lasting effect, it should be done with TPNOTRAN set).
TPEBLOCK]
TPCALL and TPNOBLOCK was specified.
TPGOTSIG]
TPSIGRSTRT was not specified.
TPEPROTO]
TPCALL was called in an improper context.
TPESYSTEM]
[TPEOS]
TPACALL(), TPFORWARD(), TPGPRIO(), TPRETURN(), TPSPRIO(), tperrordetail(3), tpstrerrordetail(3)