The msgrcv service receives messages from a message queue.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1QRC): | 31-bit |
AMODE (BPX4QRC): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4QRC with the same parameters. The Message_Address and Message_Type parameters are doublewords.
Specifies the message queue identifier.
The name of a fullword (doubleword) field that contains the address of a buffer that is mapped by MSGBUF or MSGXBUF (see BPXYMSG — Map interprocess communication message queues).
The name of the fullword that contains the ALET for Message_Address, which identifies the address space or data space where the buffer resides.
You should specify a Message_Alet of 0 if the buffer is in the user's address space (current primary address space).
You should specify a Message_Alet of 2 if the buffer resides in the home address space.
If a value other than 0 or 2 is specified for the Message_ALET, the value must represent a valid entry in the dispatchable unit access list (DUAL).
Specifies the length of the message text that is to be placed in the buffer that is pointed to by Message_Address parameter.
In 31-bit mode, if Msg_Info is specified, this buffer is 20 bytes longer than Message_Length; otherwise this buffer is 4 bytes longer than Message_Length. In 64-bit mode, if Msg_Info is specified, this buffer is 28 bytes longer than Message_Length; otherwise this buffer is 8 bytes longer than Message_Length.
The message that is received may be truncated (see MSG_NOERROR of Message_Flag). A value of zero with MSG_NOERROR is useful for receiving the message type without the message text.
MSG_NOERROR specifies that the received message is to be truncated to Message_Length (mapped in BPXYMSG). The truncated part of the message is lost, and no indication of the truncation is given to the caller.
MSG_INFO specifies that the received message is to be of the MSGXBUF and not the MSGBUF format, mapped in BPXYMSG. MSG_INFO specifies that extended information is to be received. This is similar to the msgxrcv() C language function.
The name of a fullword in which the msgrcv service returns -1, or the number of MSG_MTEXT bytes returned.
Return_code | Explanation |
---|---|
E2BIG | MSG_MTEXT is greater than Message_Length, and MSG_NOERROR is not set. The following reason code can accompany the return code: JRMsq2Big. |
EACCES | Operation permission is denied to the calling task: JRIpcDenied. If the message queue was built with the Ipc_RcvTypePID, and the MSG_TYPE was other than the invoker's process ID, the following reason code accompanies the return code: JRTypeNotPID. |
EIDRM | The Message_Queue_ID was removed from the system while the invoker was waiting. The following reason code can accompany the return code: JRIpcRemoved. |
EINTR | The function was interrupted by a signal. The following reason code can accompany the return code: JRIpcSignaled. |
EINVAL | Message_Queue_ID is not a valid message queue identifier; or the Message_Length parameter is less than 0. The following reason codes can accompany the return code: JRIpcBadID or JRMsqBadSize. |
EFAULT | The Message_Address parameter specified an address that caused the syscall to program check. The following reason code can accompany the return code: JRBadAddress. |
ENOMSG | The queue does not contain a message of the desired type, and Ipc_NOWAIT is set. The following reason code can accompany the return code: JRMsqNoMsg. |
The name of a fullword in which the msgrcv service stores the reason code. The msgrcv service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
The caller of the msgrcv service is restricted by ownership, read, and read-write permissions that are defined by msgget and msgctl Ipc_SET.
See BPX1QRC (msgrcv) example for an example using this callable service.