CREMBX

Create a mailbox

 

 

 

VSupported on OpenVMS
xcall CREMBX(channel, [name], [temp_flag], [message_size], [memory], [mask], 
&     [access][, wait])

Arguments

channel

The expression that contains the Synergy DBL channel on which the mailbox is to be opened. (n)

name

(optional) An expression that contains the logical name to be assigned to the mailbox. (a)

temp_flag

(optional) An expression that indicates whether the mailbox being created is temporary or permanent: (n)

0 = Temporary mailbox (default)

1 = Permanent mailbox

message_size

(optional) An expression that contains the maximum size of messages that can be sent to the mailbox. If this value isn’t specified, the system defaults to the DEFMBXMXMSG value in SYSGEN. (n)

memory

(optional) An expression that contains the number of bytes of memory used to buffer messages sent to the mailbox. If memory isn’t specified, the system defaults to the DEFMBXBUFQUO value in SYSGEN. (n)

mask

(optional) An expression that specifies the protection mask. The protection mask is a value that consists of four groups of four‑bit fields. See the Discussion for additional information about protection masks. The default is no protection. (n)

access

(optional) An expression that indicates the access mode to be associated with the channel to which the mailbox is assigned: (n)

PSL$C_KERNEL = Kernel

PSL$C_EXEC = Executive

PSL$C_SUPER = Supervisor

PSL$C_USER = User (default)

wait

(optional) An expression that determines whether the program will wait for another program to write to or read from the mailbox before processing continues. A nonzero value forces the program to wait. (n)

Discussion

The CREMBX subroutine enables you to create a mailbox using the OpenVMS $CREMBX service.

The user must have TMPMBX privileges to create a temporary mailbox, or PRMMBX privileges to create a permanent mailbox. The specified logical name is entered into the group or system logical‑name table for a temporary or permanent mailbox. If the logical name is already associated with a mailbox, that mailbox is opened for the user. CREMBX arguments parallel those of the OpenVMS $CREMBX system service. Refer to the $CREMBX system service section in your OpenVMS System Services Reference Manual for details.

Mask is a decimal value that consists of four groups of four‑bit fields. The four groups are World, Group, Owner, and System. The four‑bit fields are L, P, W, and R, for logical access, physical access, write access, and read access, respectively. The bits in the mask value are assigned as follows:

Groups

WORLD

GROUP

OWNER

SYSTEM

Fields

L

P

W

R

L

P

W

R

L

P

W

R

L

P

W

R

Bits

15

14

13

12

11

10

09

08

07

06

05

04

03

02

01

00

Thus, a mask value of 10 sets fields L and W in the System group. A value of 12288 sets fields W and R in the World group.

Examples

Let’s assume program A opens a mailbox using the following statement:

xcall crembx(11, "REDMBX:", 1, ,,,, 0)

This statement tells the system to create a permanent mailbox and associate the logical name REDMBX with it. The mailbox is opened for I/O on Synergy DBL channel 11. If a mailbox is already associated with the name REDMBX, that mailbox is opened. The last argument (0) tells the program to continue execution rather than wait for a READS or WRITES on the mailbox. If program B later executes the following line:

open(9, i, "REDMBX")

the open processor will determine that the filename is a logical name associated with an existing mailbox and open it. This action is equivalent to executing the following statement:

xcall crembx(9, "REDMBX", 1, ,,, 0)

Note that if you want to open the mailbox without waiting for a READS or WRITES, you must either open it with the CREMBX subroutine, or, if you open it with the OPEN statement, specify WAIT:0 on the READS statement.