Previous Page Contents Page Next Page

4.9 MC_RECEIVE and RECEIVE Verbs

APPC provides three different verbs which are used to receive data from the partner TP. Most of the parameters and return codes are the same for all three verbs, but each operates in a different way and provides a different function. Common information which applies to all three verbs are explained together in this section; each verb is then explained in detail.

The three RECEIVE verbs are:

4.9.1 How a TP Receives Data

The process through which the local TP receives data is as follows:

  1. The local TP issues a receive verb until it finishes receiving a complete unit of data. The data received can be any of the following:

    • One data record transmitted in a mapped conversation

    • One logical record transmitted in a basic conversation

    • A buffer of data received independent of its logical-record format in a basic conversation

    The local TP may need to issue several RECEIVE verbs in order to receive a complete unit of data. Once a complete unit of data has been received, the local TP can manipulate it.

  2. The local TP issues another receive verb. This has one of the following effects:

    • If the partner TP has sent more data, the local TP begins to receive a new unit of data.

    • If the partner TP has finished sending data or is waiting for confirmation, status information (available through the what_rcvd parameter) indicates the next action the local TP normally takes. For more information, see The what_rcvd Parameter.

Alternatively, the local TP can set a parameter rtn_status when issuing the receive verb; this indicates that any status information available is to be returned with the data. In this case, the receive verb that returns the last part of the data also returns the status information, and the local TP does not need to issue a separate receive verb for it. For more information, see The what_rcvd Parameter.

4.9.2 The what_rcvd Parameter

After issuing one of the [MC_]RECEIVE verbs, a TP will normally use the what_rcvd parameter to determine its next action. The values referring to a data type of User Control will be returned on a mapped conversation on the Solaris system, and the values referring to a data type of PS Header will be returned on a mapped conversation on the Solaris system with a synchronization level of AP_SYNCPT.

The following list describes the possible values of the what_rcvd parameter, with the action normally taken by the TP for each of them:

AP_DATA
AP_DATA_COMPLETE
AP_DATA_INCOMPLETE
AP_USER_CONTROL_DATA_COMPLETE
AP_USER_CONTROL_DATA_INCMP
AP_PS_HEADER_COMPLETE
AP_PS_HEADER_INCOMPLETE

The local TP received data from the partner TP. It will normally continue to issue RECEIVE verbs until it receives one of the other what_rcvd parameters in this list.

AP_SEND

The partner TP issued the [MC_]PREPARE_TO_RECEIVE verb without requesting confirmation, or issued the [MC_]SEND_DATA verb with a send type of PREPARE_TO_RECEIVE. The local TP is now in Send state, so it will normally begin to send data.

AP_CONFIRM_DEALLOCATE

The partner TP issued the [MC_]DEALLOCATE verb with a dealloc_type parameter indicating that confirmation was required, or issued the [MC_]SEND_DATA verb with a send type of DEALLOCATE. The local TP is now in Confirm_Deallocate state, so it will normally issue the [MC_]CONFIRMED verb to confirm deallocation of the conversation.

AP_CONFIRM_SEND

The partner TP issued the [MC_]PREPARE_TO_RECEIVE verb with ptr_type and dealloc_type parameters indicating that confirmation was required, or issued the [MC_]SEND_DATA verb with a send type of PREPARE_TO_RECEIVE_CONFIRM. The local TP is now in Confirm_Send state, so it will normally issue the [MC_]CONFIRMED verb to confirm the state change and then begin to send data.

AP_CONFIRM_WHAT_RECEIVED

The partner TP issued the [MC_]CONFIRM verb, or issued the [MC_]SEND_DATA verb with a send type of CONFIRM. The local TP is now in Confirm state, so it will normally issue the [MC_]CONFIRMED verb.

The following values will only be returned if the local TP specified AP_YES for the rtn_status (return status with data) parameter:

AP_DATA_SEND
AP_DATA_COMPLETE_SEND
AP_UC_DATA_COMPLETE_SEND
AP_PS_HDR_COMPLETE_SEND

The partner TP sent data and then issued the [MC_]PREPARE_TO_RECEIVE verb without requesting confirmation, or issued the [MC_]SEND_DATA verb with a send type of PREPARE_TO_RECEIVE. The local TP is now in Send_Pending state, so it will normally begin to send data.

AP_DATA_CONFIRM_DEALLOCATE
AP_DATA_COMPLETE_CONFIRM_DEALL
AP_UC_DATA_COMPLETE_CNFM_DEALL
AP_PS_HDR_COMLETE_CNFM_DEALL

The partner TP sent data and then issued the [MC_]DEALLOCATE verb with a dealloc_type parameter indicating that confirmation was required, or issued the [MC_]SEND_DATA verb with a send type of DEALLOCATE. The local TP is now in Confirm_Deallocate state, so it will normally issue the [MC_]CONFIRMED verb to confirm deallocation of the conversation.

AP_DATA_CONFIRM_SEND, AP_DATA_COMPLETE_CONFIRM_SEND, AP_UC_DATA_COMPLETE_CNFM_SEND, AP_PS_HDR_COMPLETE_CNFM_SEND

The partner TP sent data and then issued the [MC_]PREPARE_TO_RECEIVE verb with ptr_type and dealloc_type parameters indicating that confirmation was required, or issued the [MC_]SEND_DATA verb with a send type of PREPARE_TO_RECEIVE_CONFIRM. The local TP is now in Confirm_Send state, so it will normally issue the [MC_]CONFIRMED verb to confirm the state change and then begin to send data.

AP_DATA_CONFIRM, AP_DATA_COMPLETE_CONFIRM, AP_UC_DATA_COMPLETE_CONFIRM, AP_PS_HDR_COMPLETE_CONFIRM

The partner TP sent data and then issued the [MC_]CONFIRM verb, or issued the [MC_]SEND_DATA verb with a send type of CONFIRM. The local TP is now in Confirm state, so it will normally issue the [MC_]CONFIRMED verb.

In all CONFIRM cases above, the TP may issue the [MC_]SEND_ERROR verb instead of the [MC_]CONFIRMED verb, to indicate that an error was detected in the supplied data or in processing. If it issues [MC_]SEND_ERROR in Send_Pending state (after receiving AP_DATA_SEND, AP_DATA_COMPLETE_SEND, AP_UC_DATA_COMPLETE_SEND , or AP_PS_HDR_COMPLETE_SEND), it can specify whether the error was detected in the supplied data, or in its own data or processing. For more information, see the description of the [MC_]SEND_ERROR verb in MC_SEND_ERROR and SEND_ERROR.

4.9.3 End of Data

If the local TP issues one of the basic-conversation RECEIVE verbs and sets the fill parameter to AP_BUFFER, the receipt of data ends when max_len or end of data is reached. End of data is indicated by either of the following:

To determine if end of data has been reached, the local TP reissues one of the RECEIVE verbs. If the new primary_rc parameter contains AP_OK and what_rcvd contains AP_DATA or AP_DATA_INCOMPLETE , end of data has not been reached. If, however, end of data has been reached, the primary_rc or what_rcvd parameter will indicate the cause of the end of data.

4.9.4 Testing the what_rcvd Parameter

The local TP can use any of the [MC_]RECEIVE verbs to determine whether the partner TP has data to send, seeks confirmation, or has changed the conversation state, without receiving any data. To do this, it issues the [MC_]RECEIVE verb with the max_len parameter set to 0 (zero), and then (if the verb returns with a primary_rc of AP_OK) tests the what_rcvd parameter.

Previous Page Contents Page Top of Page Next page