HPlogo LU 6.2 API Application Programmer's Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 5  Intrinsic Descriptions

MCRcvAndWait

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Waits for information to arrive on the specified conversation and then receives the information.

Syntax

			               I16V        I16             I16
									MCRcvAndWait(ResourceID, Length, RequestToSendReceived,
 
 					             CA       I16        I32
 								            Data, WhatReceived, Status);

Parameters

ResourceID

Required; 16-bit signed integer by value; input. This is the unique resource ID number assigned to this conversation when it was allocated. See MCAllocate or MCGetAllocate, in this chapter, for more information.

Length

Required; 16-bit signed integer by value; input/output.

Input:

The Length value that the local TP passes to the remote TP indicates the maximum amount of data, in bytes, that the local TP can receive in its Data parameter. The Length value must not exceed 4092 bytes on MPE V, or 32763 bytes on MPE XL. A Length of 0 means that only control or error information can be received (no data).

Output:

If data is received (WhatReceived = DATA_COMPLETE or DATA_INCOMPLETE), the Length value that the remote TP returns to the local TP is the actual length of the data received. If control information is received (WhatReceived = SEND, CONFIRM, CONFIRM_SEND, or CONFIRM_DEALLOCATE), the remote TP does not change the value in the Length parameter, so it contains whatever was supplied as input.

RequestToSendReceived

Required; 16-bit signed integer; output. Indicates whether the remote TP has issued a RequestToSend. Possible values are as follows:

1 = YES

Indicates a RequestToSend has been received from the remote TP. The remote TP has issued the equivalent of the MCReqToSend intrinsic, requesting that the local TP enter Receive state and place the remote TP in Send state.

0 = NO

No RequestToSend has been received.

Data

Required; character array; output; EBCDIC. The character array into which the local TP will receive data sent by the remote TP. The length of the Data array must be greater than or equal to the value in the Length parameter.

If the data comes from an EBCDIC application, the local TP must convert it from EBCDIC to ASCII. The MPE CTRANSLATE intrinsic, or the NLTRANSLATE intrinsic on MPE XL, may be used.

WhatReceived

Required; 16-bit signed integer; output. If the value returned in the Status parameter is 0, then the WhatReceived parameter contains a value indicating the type of information received. Possible values are as follows:

1 = DATA_COMPLETE

Indicates that a complete data record, or the final portion of a data record, has been received. The Length parameter determines the amount of data that can be received in a single call to MCRcvAndWait. If a data record is larger than the value in the Length parameter, you must call MCRcvAndWait more than once to receive a complete record.

2 = DATA_INCOMPLETE

Indicates that less than a complete record has been received, and you must call MCRcvAndWait again to receive the next portion of it. Incomplete data records are received when the size of a record exceeds the value in the Length parameter. When the final portion of a data record is received, the WhatReceived parameter returns 1 (DATA_COMPLETE).

4 = SEND

Indicates that the remote TP has issued the equivalent of MCPrepToRcv or MCRcvAndWait and has entered Receive state. The local TP is now in Send state and can issue only those intrinsics that are callable from Send state.

5 = CONFIRM

Indicates that the remote TP has issued the equivalent of MCConfirm, placing the local TP in Confirm state. Unless it detects an error, the local TP must respond with a call to MCConfirmed.

6 = CONFIRM_SEND

Indicates that the remote TP has issued the equivalent of MCPrepToRcv with a synchronization level of CONFIRM. The local TP is placed in Confirm Send state. Unless it detects an error, it must send a confirmation response to the remote and enter Send state.

7 = CONFIRM_DEALLOCATE

Indicates that the remote TP has issued the equivalent of MCDeallocate with a synchronization level of CONFIRM. The local TP is placed in Confirm Deallocate state. Unless it detects an error, it must send a confirmation response to the remote and call MCDeallocate with a DeallocateType of LOCAL. When the remote TP deallocates normally, a status info value of +100 is returned to the local TP.

Status

Required; 32-bit signed integer; output. Indicates the result of intrinsic execution. See the "Status Parameter" section, earlier in this chapter, for more information.

Description

The MCRcvAndWait intrinsic waits for information to arrive on the conversation specified in the ResourceID parameter, then it receives the information from the receive buffer into the Data parameter. MCRcvAndWait is used to receive data and control information.

NOTE: A TP cannot receive both data and control information in the same call to MCRcvAndWait. If both data and control information have been received in the receive buffer, a TP must make separate calls to MCRcvAndWait for each one.

The only control information that can be received in the same MCRcvAndWait call with data is the RequestToSendReceived notification.

If posting has been set on the specified conversation, MCRcvAndWait ends posting.

The local TP does not have to call MCPrepToRcv to enter Receive state before it calls MCRcvAndWait. A TP can call MCRcvAndWait directly from Send state. The send buffer will be flushed, the remote TP will be placed in Send state, and the local TP will be placed in Receive state.

When logical records sent by the remote are larger than the receive buffer (4092 bytes on MPE V, or 32763 bytes on MPE XL), the local TP must call MCRcvAndWait more than once to receive each record.

NOTE: If the local TP will be receiving data records larger than the receive buffer, it must allocate more than one location for storing data. Data received in the Data parameter during the first call to MCRcvAndWait will be overwritten during the second call unless it is moved to another location.

The MCRcvAndWait intrinsic differs from the MCRcvNoWait intrinsic in the following ways:

  1. MCRcvAndWait can be used to change the conversation state of the local TP from Send state to Receive state. MCRcvNoWait can be called only from Receive state.

  2. MCRcvAndWait waits for information from the remote before returning control to the calling TP. MCRcvNoWait does not wait for information to arrive. It checks to see if any information is available in the receive buffer, and if the buffer is empty, it returns a status info value of +38 ( Not Posted) and returns control to the TP.

  3. MCRcvAndWait can receive 4092 bytes on MPE V, or 32763 bytes on MPE XL, in a single intrinsic call. MCRcvNoWait can receive a maximum of 4092 bytes in a single intrinsic call, on MPE V or MPE XL.

Figure 5-5 “Conversation with Calls to MCRcvAndWait” shows a conversation in which both sides call MCRcvAndWait. Notice that, when MCRcvAndWait is called from Send state, the TP that called it is placed in Receive state and must wait for data to arrive before it can continue processing. The MCRcvAndWait intrinsic does not finish executing until information arrives for it to receive (or until the Timer expires. See MCAllocate or MCGetAllocate for information on the Timer).

Figure 5-5 Conversation with Calls to MCRcvAndWait

Conversation with Calls to MCRcvAndWait

Status Info Values

 0    Successful Completion.
-1    Intrinsic called with parameter out of bounds.
-2    Invalid 'ResourceID' parameter specified in intrinsic call.
-11   Out of range 'Length' parameter specified in intrinsic call.
-13   Data buffer specified in intrinsic call is out of bounds.
-20   Not enough stack space for intrinsic to run.
-40   Intrinsic called in invalid state.
-50   Allocation Error.
-51   Resource Failure:  Retry possible.
-52   Resource Failure:  No retry possible.
-56   Program Error:  No data truncation has occurred.
-60   Program Error:  Data may have been purged.
+80   Timer has expired.
-90   An internal error in Presentation Services has occurred.
-91   An internal error in the APPC subsystem has occurred.
+100  Deallocate Normal received from the remote TP.
-1002 An internal error at the mapped conversation level has occurred.
-1003 Required parameter missing.
-1020 Deallocate Abend.
-1050 Invalid 'Data' parameter specified in intrinsic call.
-1105 Internal Error: Conversation deallocated.
Feedback to webmaster