Receive_and_Wait

Equivalent to:
  • LU 6.2 (MC_)Receive_and_Wait
  • CPI Receive (CMRCV)

Waits for information to arrive on the conversation and then receives the information. If information is already available, the program receives it without waiting.

Requirements

Format

Figure 1. ATBRCVW - LU 6.2 Receive and Wait

CALL ATBRCVW(
        Conversation_id,
        Fill,
        Receive_length,
        Access_token,
        Buffer,
        Status_received,
        Data_received,
        Request_to_send_received,
        Notify_type,
        Return_code
       );

Parameters

Conversation_id
Supplied parameter
  • Type: Character string
  • Char Set: No restriction
  • Length: 8 bytes

Conversation_id, sometimes called the resource identifier, identifies a conversation to the system.

Fill
Supplied parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

In a basic conversation, specifies whether the program is to receive data in terms of the logical record format of the data.

Valid values for this parameter are:
Value
Meaning
0
LL

specifies the program is to receive one logical record, or whatever portion of the logical record that is available, up to the length specified.

1
Buffer

specifies the program is to receive data independent of its logical record format, up to the length specified.

This parameter has no effect on a mapped conversation, but must contain a valid value.

Receive_length
Supplied/Returned parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Receive_length specifies the maximum amount of data that the program is to receive. When control is returned to the program, this parameter contains the actual amount of data that the program received up to the maximum. If the program receives information other than data (that is, a control signal), this parameter remains unchanged.

No value is returned in Receive_length if Data_received is not returned to the program or if Data_received indicates No_data_received.

Access_token
Supplied parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Access_token specifies the Access List Entry Token (ALET) of the address space or data space in which the buffer resides for Receive_and_wait.

APPC/MVS always uses access_token in conjunction with the address of the buffer in order to resolve addressing to the transaction program's data. To specify that the buffer address passed should not be ALET qualified, an Access_token value of zero should be supplied. APPC/MVS will then consider the buffer to reside in the primary address space of the caller.

The Access_token can:
  • Represent an entry on the dispatchable unit access list (DU-AL)
  • Represent an entry on the caller's primary address access list (PASN-AL), only if the entry points to a SCOPE=COMMON data space.
The Access_token cannot:
  • Be the value 1 (which indicates secondary ASID)
  • Represent an entry on the caller's PASN-AL that does not point to a SCOPE=COMMON data space.

For more information about ALETs for SCOPE=COMMON data spaces, see Features of the MVS-Specific Services.

Buffer
Returned parameter
  • Type: Character string
  • Char Set: No restriction
  • Length: 0-2,147,483,647 bytes
Buffer specifies the buffer that is to contain the data to be received. The call supplies the buffer that is to contain the data. APPC/MVS returns the data in the supplied buffer. This data can consist entirely of data (for mapped conversations) or logical records (for basic conversations).

If the data consists of logical records, each such record consists of a two-byte length field followed by a data field; the length of the data field can range from zero to 32,765 bytes. The length of the record includes the two-byte length field; therefore, logical-record length values of X'0000', X'0001', X'8000', and X'8001' are not valid.

No value is returned in Buffer if Data_received is not returned to the program or if Data_received indicates No_data_received.

Status_received
Returned parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Status_received specifies what control information was received.

Valid return values for this parameter are:
Value
Meaning
0
No_status_received
1
Send_received

Indicates that the partner program has entered Receive state, placing the local program in Send state. The local program may now issue a Send_data call.

2
Confirm_received

Indicates that the partner program has issued a confirmation request, requesting the local program to respond with a Confirmed call. The program may respond instead by issuing a call other than Confirmed, such as Send_error.

3
Confirm_send_received
Indicates that the partner program executed the prepare to receive function with one of the following:
  • A type of confirm
  • A type of sync_level and the synchronization level is confirm
  • A type of sync_level and the synchronization level is syncpt, followed by a confirmation request.
The local program may respond by issuing a Confirmed call, or by issuing another call such as Send_error.
4
Confirm_dealloc_received

Indicates the partner program executed the deallocate function with a type of confirm; or with a type of sync_level and the synchronization level is confirm. The local program may respond by issuing a Confirmed call, or by issuing another call such as Send_error.

For a conversation with synchronization level set to syncpt, the following values are also valid:
Value
Meaning
5
Take_syncpt

Indicates that the remote program has issued a syncpoint request, requesting the local program to respond with a Commit call to commit all protected resources throughout this transaction. When appropriate, the local program may respond by issuing a call other than Commit, such as Backout or Send_Error, which causes the transaction to back out.

6
Take_syncpt_send

Indicates that the remote program executed the Prepare_To_Receive function with a Prepare_To_Receive_Type of sync_level and the synchronization level set to syncpt followed by a syncpoint request, requesting the local program to respond with a Commit call to commit all protected resources throughout this transaction. The local program should respond with a Commit call to commit all protected resources throughout this transaction. When appropriate, the local program may respond by issuing a call other than Commit, such as Backout or Send_Error.

7
Take_syncpt_dealloc

Indicates that the remote program executed the Deallocate function with a deallocate_type of sync_level and the synchronization level set to syncpt followed by a syncpoint request, requesting the local program to respond with a Commit call to commit all protected resources throughout this transaction. The local program should respond with a Commit call to commit all protected resources throughout this transaction and have the conversation deallocated. When appropriate, the local program may respond by issuing a call other than Commit such as Backout or Send_Error.

Data_received
Returned parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Data_received specifies what type of data was received.

Valid return values for this parameter are:
Value
Meaning
0
No_data_received

No data was received

1
Data_received

When the conversation is basic and the value of the Fill parameter was set to Buffer, this return value indicates that data (independent of its logical record format) was received.

2
Complete_data_received
  • For a basic conversation

    When the value of the Fill parameter was set to LL, this return value indicates that a complete logical record, or the last remaining portion thereof, was received.

  • For a mapped conversation

    This return value indicates that a complete data record, or the last remaining portion thereof, was received.

3
Incomplete_data_received
  • For a basic conversation

    When the value of the Fill parameter was set to LL, this return value indicates that less than a complete logical record was received. The local program must issue one or more additional receive calls to receive the remainder of the data.

  • For a mapped conversation

    This return value indicates that less than a complete data record was received. The local program must issue one or more additional receive calls to receive the remainder of the data.

If Return_code indicates any value other than OK or Deallocated_Normal, a value is not returned in Data_received.

Request_to_send_received
Returned parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Request_to_send_received specifies whether or not Request_to_send notification has been received.

Valid return values for this parameter are:
Value
Meaning
0
Request_to_send_not_received

Indicates that Request_to_send notification has not been received

1
Request_to_send_received

Indicates that the partner program has issued a Request_to_send, requesting the local program to enter Receive state.

If Return_code indicates Program_parameter_check or Program_state_check, a value is not returned in Request_to_send_received.

Notify_type
Supplied parameter
  • Type: Structure
  • Char Set: N/A
  • Length: 4-8 bytes
Specifies the type of processing and notification (synchronous or asynchronous) requested for this service. Programs can request asynchronous processing, which returns control to the program immediately and later notifies the program by ECB when the service is complete. The possible types are:
  • None

    No notification is requested. The service is performed synchronously, and control is returned to the caller when processing is complete. All returned parameters are set on return to the caller. To specify no notification, set the parameter value to a four-byte structure containing binary zeros.

  • ECB

    Programs can request asynchronous processing by specifying an ECB to be posted when processing completes. To specify an ECB, set the parameter to an eight-byte structure containing a fullword binary one (X'00000001') followed by the address of a fullword area to be used as the ECB. The ECB must reside in the home address space.

    When you specify an ECB, control is returned before processing is complete, with only the return code set. If the asynchronous request was accepted, the return code is set to 0 to indicate that the service is being processed asynchronously. Other returned parameters are filled in during asynchronous processing, and the specified ECB is posted when all returned parameters are set. The completion code field in the ECB contains the return code for the service.

Return_code
Returned parameter
  • Type: Integer
  • Char Set: N/A
  • Length: 32 bits

Return_code specifies the return code that is returned to the local program. In cases where an error code is returned, the program should not examine any other returned variable associated with the call as nothing is placed in the variables.

See the following section for descriptions of return codes that can be returned to a caller of Receive_and_Wait.

Return Codes

If Receive_and_Wait is called in Send state, possible values of Return_code are:
Decimal Value
Meaning
0
OK
3
Conversation_type_mismatch
5
PIP_not_specified_correctly
6
Security_not_valid
8
Sync_lvl_not_supported_pgm
9
TPN_not_recognized
10
TP_not_available_no_retry
11
TP_not_available_retry
17
Deallocated_abend
18
Deallocated_normal
20
Product_specific_error
21
Program_error_no_trunc
22
Program_error_purging
24
Program_parameter_check
25
Program_state_check
26
Resource_failure_no_retry
27
Resource_failure_retry
30
Deallocated_abend_svc
31
Deallocated_abend_timer
32
SVC_error_no_trunc
33
SVC_error_purging
100
Take_backout
130
Deallocated_abend_bo
131
Deallocated_abend_svc_bo (basic conversations only)
132
Deallocated_abend_timer_bo (basic conversations only)
133
Resource_failure_no_retry_bo
134
Resource_failure_retry_bo
Note: Return codes 100 through 134 are possible values only for conversations with a synchronization level of syncpt.
If Receive_and_Wait is called in Send-pending state, possible values of Return_code are:
Decimal Value
Meaning
0
OK
17
Deallocated_abend
18
Deallocated_normal
20
Product_specific_error
21
Program_error_no_trunc
22
Program_error_purging
24
Program_parameter_check
25
Program_state_check
26
Resource_failure_no_retry
27
Resource_failure_retry
30
Deallocated_abend_svc
31
Deallocated_abend_timer
32
SVC_error_no_trunc
33
SVC_error_purging
100
Take_backout
130
Deallocated_abend_bo
131
Deallocated_abend_svc_bo (basic conversations only)
132
Deallocated_abend_timer_bo (basic conversations only)
133
Resource_failure_no_retry_bo
134
Resource_failure_retry_bo
Note: Return codes 100 through 134 are possible values only for conversations with a synchronization level of syncpt.
If Receive_and_Wait is called in Receive state, possible values of Return_code are:
Decimal Value
Meaning
0
OK
3
Conversation_type_mismatch
5
PIP_not_specified_correctly
6
Security_not_valid
8
Sync_lvl_not_supported_pgm
9
TPN_not_recognized
10
TP_not_available_no_retry
11
TP_not_available_retry
17
Deallocated_abend
18
Deallocated_normal
20
Product_specific_error
21
Program_error_no_trunc
22
Program_error_purging
23
Program_error_trunc
24
Program_parameter_check
25
Program_state_check
26
Resource_failure_no_retry
27
Resource_failure_retry
30
Deallocated_abend_SVC
31
Deallocated_abend_timer
32
SVC_error_no_trunc
33
SVC_error_purging
34
SVC_error_trunc
100
Take_backout
130
Deallocated_abend_bo
131
Deallocated_abend_svc_bo (basic conversations only)
132
Deallocated_abend_timer_bo (basic conversations only)
133
Resource_failure_no_retry_bo
134
Resource_failure_retry_bo
Note: Return codes 100 through 134 are possible values only for conversations with a synchronization level of syncpt.

The following table lists all of the possible return codes for Receive_and_Wait:

Table 1. Return Codes for the Receive_and_Wait Service
Return Code Value, Meaning, and Action
0 Value: OK

Meaning: The call completed successfully.

System Action: If the call specified a Notify_type of ECB, APPC/MVS posts the ECB specified on the Notify_type parameter when APPC/MVS finishes processing the call asynchronously.

Application Programmer Response: None required.

3 Value: Conversation_type_mismatch

Meaning: The partner LU rejected an allocate request. The local TP called the Allocate service and specified a value of Basic_conversation or Mapped_conversation on the Conversation_type parameter. The partner TP does not support the respective basic or mapped conversation protocol boundary.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: When requesting the allocate, change the Conversation_type parameter to specify a conversation type that the partner TP supports.

5 Value: PIP_not_specified_correctly

Meaning: The partner LU rejected an allocate request. The partner TP defined one or more initialization parameter (PIP) variables, which APPC/MVS does not support.

System Action: The system returns this return code on a call that occurs after the call to Allocate. The system does not return this code to callers of the CPI Communications Allocate call.

Application Programmer Response: Ask the partner system programmer to change the partner TP so it does not expect PIP data from the TP running on MVS.

6 Value: Security_not_valid

Meaning: The partner LU rejected an allocate request. The specified security information is not valid.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: See Diagnosing Problems with APPC/MVS TPs for methods to use to diagnose the return code. See Error_Extract for the Error_Extract calling format.

8 Value: Sync_lvl_not_supported_pgm

Meaning: The partner LU rejected an allocate request. The local TP specified a synchronization level (on the Sync_level parameter) that the partner TP does not support.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: See Allocate for an explanation of the Sync_level parameter. When requesting the allocate, ensure that the Sync_level parameter specifies a correct value.

9 Value: TPN_not_recognized

Meaning: The partner LU rejected an allocate request. The local TP specified a partner TP that the partner LU does not recognize.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: Ask the partner system programmer to provide a valid partner TP name. When requesting the allocate, specify the valid partner TP name.

10 Value: TP_not_available_no_retry

Meaning: The partner LU rejected an Allocate request. The local TP specified a partner TP that is known to the partner LU, but the partner LU cannot start the TP. The condition is not temporary. The TP should not retry the Allocate request.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: See Diagnosing Problems with APPC/MVS TPs for methods to use to diagnose the return code. See Error_Extract for the Error_Extract calling format.

11 Value: TP_not_available_retry

Meaning: The partner LU rejected an allocate request. The local TP specified a partner TP that the partner LU recognizes but cannot start. The condition might be temporary.

System Action: The system returns this return code on a call that occurs after the call to Allocate.

Application Programmer Response: Retry the Allocate request. If the error persists, see Diagnosing Problems with APPC/MVS TPs for methods to use to diagnose the return code. See Error_Extract for the Error_Extract calling format.

17 Value: Deallocate_abend

Meaning: A partner TP called the Deallocate service. The request specified a Deallocate_type of Deallocate_abend.

System Action: If the partner TP was in Receive state when it called Deallocate, the system purges information sent by the local TP that was not received by the partner TP. The system returns this return code to the local TP when it calls an APPC service in Send or Receive state.

Application Programmer Response: See the application programmer response for return code six for this service.

18 Value: Deallocate_normal

Meaning: A partner TP called the Deallocate service for a basic or mapped conversation. The request specified a Deallocate_type of Deallocate_sync_level or Deallocate_flush.

System Action: The system returns this return code to the local TP when it calls a service while the conversation is in Receive state.

Application Programmer Response: None required.

20 Value: Product_specific_error

Meaning: The system found a product-specific error.

System Action: The system might write symptom records, which describe the error, to the logrec data set.

Application Programmer Response: See Diagnosing Problems with APPC/MVS TPs for methods to use to diagnose the return code. See Error_Extract for the Error_Extract calling format. If necessary, see Diagnosing Product-Specific Errors for more information about product-specific errors.

21 Value: Program_error_no_trunc
Meaning: Indicates one of the following:
  • A partner TP called the Send_Error service for a mapped conversation. The conversation for the local TP was in Send state. No truncation occurs at the mapped conversation protocol boundary.
  • A partner TP called Send_Error for a basic conversation. The conversation was in Send state. The call did not truncate a logical record. No truncation occurs at the basic conversation protocol boundary when a TP calls Send_Error either before sending any logical records or after sending a complete logical record.

System Action: The system returns this return code to the local TP when it calls the Receive service, before the TP receives any data records or after it receives one or more data records.

Application Programmer Response: See the application programmer response for return code six for this service.

22 Value: Program_error_purging

Meaning: A partner TP called the Send_Error service for a basic or mapped conversation. The conversation for the partner TP was in Receive or Confirm state.

System Action: The system returns this return code to the local TP when it calls an APPC service before sending any information. If the TP called Send_Error while in Receive state and before it received all the information that the partner TP sent, the system might purge the data. If the TP called Send_Error while in Receive or Confirm state but after it received all the information that the partner TP sent, the system does not purge the data.

Application Programmer Response: See the application programmer response for return code six for this service.

23 Value: Program_error_trunc

Meaning: The partner TP called the Send_Error service for a basic conversation. The conversation for the partner TP was in Send state, and the call truncated a logical record. Truncation occurs at the basic conversation protocol boundary when a TP begins sending a logical record and then makes a Send_error call before sending the complete logical record.

System Action: The system returns this return code to the local TP on a Receive call that occurs after the TP receives the truncated logical record.

Application Programmer Response: See the application programmer response for return code six for this service.

24 Value: Program_parameter_check

Meaning: The system detected a program parameter check.

System Action: The system returns this return code to the caller of the APPC service in error.

Application Programmer Response: See the application programmer response for return code six for this service.

25 Value: Program_state_check

Meaning: The local TP called a service while running in a state in which the call is not valid. The TP should not examine any other returned variables associated with the call because nothing is placed in those variables.

System Action: The state of the conversation remains unchanged. For a list of states that are valid for each call, see APPC/MVS Conversation State Table. The conversation was in send state and the TP started, but the TP did not finish sending a logical record.

Application Programmer Response: See the application programmer response for return code six for this service.

26 Value: Resource_failure_no_retry

Meaning: An error caused the conversation to terminate. The condition is not temporary. The application should not try to run the transaction until the condition is corrected.

System Action: The system terminates the conversation.

Application Programmer Response: See the application programmer response for return code six for this service.

27 Value: Resource_failure_retry

Meaning: An error caused the conversation to terminate. The condition might be temporary.

System Action: The system terminates the conversation.

Application Programmer Response: Retry the transaction.

30 Value: Deallocated_abend_SVC

Meaning: The partner TP called Deallocate with a Deallocate_type of Deallocate_abend_SVC.

System Action: If the partner TP was in Receive state when it called Deallocate, the system purges all information that was sent by the local TP but was not yet received by the partner TP. The system returns this return code to the local TP when it calls a service while in Send or Receive state.

Application Programmer Response: See the application programmer response for return code six for this service.

31 Value: Deallocated_abend_timer

Meaning: A partner TP called the Deallocate service with a Deallocate_type of Deallocate_abend_timer.

System Action: If the partner TP was in Receive state when it called Deallocate, the system purges all information that was sent by the local TP but was not yet received by the partner TP. The system returns this return code to the local TP when it calls a service while in Send or Receive state.

Application Programmer Response: See the application programmer response for return code six for this service.

32 Value: SVC_error_no_trunc

Meaning: A partner TP called the Send_Error service, and LU services on the partner LU specified a value of SVC for the type of call. The conversation was in Send state, and the call did not truncate a logical record.

System Action: The system returns this return code to the caller of the Receive service. The system does not return this return code to callers of the CPI Communications Send_Error call.

Application Programmer Response: See the application programmer response for return code six for this service.

33 Value: SVC_error_purging

Meaning: A partner TP called the Send_Error service, and LU services on the partner LU specified a value of SVC for the type of call. The conversation for the partner TP was in Receive or Confirm state, and the call might have caused information to be purged.

System Action: The system normally returns this code to the local TP after the system sends some information to the partner TP. However, the system can also return this code to the local TP before it sends any information.

Application Programmer Response: See the application programmer response for return code six for this service.

34 Value: SVC_error_trunc

Meaning: A partner TP called the Send_Error service, and LU services on the partner LU specified a value of SVC for the type of call. The conversation for the partner TP was in send state, and the call truncated a logical record. Truncation occurs when a program begins sending a logical record and calls the Send_Error service before the complete record is sent.

System Action: The system returns this return code when the local TP calls the Receive service to receive the truncated logical record.

Application Programmer Response: See the application programmer response for return code six for this service.

100 Value: Take_backout
Meaning: This value is returned only when all of the following conditions are true:
  • The Sync_level is set to syncpt.
  • The conversation is not in Initialize state.
  • The program is using protected resources that must be backed out.

System Action: The system returns this return code to the caller of the service.

Application Programmer Response: Before it can use this conversation or any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

130 Value: Deallocated_abend_bo
Meaning: This value is returned only when all of the following conditions are true:
  • The Sync_level is set to syncpt.
  • The conversation is not in Initialize state.
  • The program is using protected resources that must be backed out.

System Action: The system returns this return code to the caller of the service.

Application Programmer Response: Before it can use this conversation or any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

131 Value: Deallocated_abend_SVC_bo)

Meaning: This return code is returned only for conversations with Sync_level set to syncpt.

The partner TP called Deallocate with a Deallocate_type of deallocate_abend_SVC.

System Action: If the partner TP was in Receive state when it called Deallocate, the system purges all information that was sent by the local TP but was not yet received by the partner TP. The system returns this return code to the local TP when it calls a service while in Send or Receive state.

Application Programmer Response: Before it can use any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

132 Value: Deallocated_abend_timer_bo

Meaning: This return code is returned only for conversations with Sync_level set to syncpt.

A partner TP called the Deallocate service with a Deallocate_type of deallocate_abend_timer.

System Action: If the partner TP was in Receive state when it called Deallocate, the system purges all information that was sent by the local TP but was not yet received by the partner TP. The system returns this return code to the local TP when it calls a service while in Send or Receive state.

Application Programmer Response: Before it can use any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

133 Value: Resource_failure_no_retry_bo

Meaning: This return code is returned only for conversations with Sync_level set to syncpt.

An error caused the conversation to terminate. The condition is not temporary. The application should not try to run the transaction until the condition is corrected.

The system terminates the conversation.Before it can use any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

System Action: The system terminates the conversation.

Application Programmer Response: Before it can use any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

134 Value: Resource_failure_retry_bo

Meaning: This return code is returned only for conversations with Sync_level set to syncpt.

An error caused the conversation to terminate. The condition might be temporary.

System Action: The system terminates the conversation.

Application Programmer Response: Before it can use any other protected conversations associated with the current context again, the local TP must issue a Backout call to restore all protected resources to their status as of the last synchronization point.

Restrictions

Transaction programs that call the Receive_and_Wait service while in task mode should not have any enabled unlocked task (EUT) functional recovery routines (FRRs) established. For more information about EUT FRRs, see the section on providing recovery in z/OS MVS Programming: Authorized Assembler Services Guide.