SHARE (open data file for shared access)

Top  Previous  Next

 

SHARE(file [,access mode])

SHARE

Opens a FILE structure for processing.

file

The label of a FILE declaration.

access mode

A numeric constant, variable, or expression which determines the level of access granted to both the user opening the file, and other users in a multi-user system. If omitted, the default value is 42h (Read/Write, Deny None).

The SHARE statement opens a FILE structure for processing and sets the access mode. The SHARE statement is exactly the same as the OPEN statement, with the exception of the default value of access mode.

The access mode is a bitmap which tells the operating system what access to grant the user opening the file and what access to deny to others using the file.

The actual values for each access level are:

              Dec.   Hex.   Access

 

User Access:     0       0h     Read Only

                1       1h     Write Only

                2       2h     Read/Write

 

Others Access:   0       0h     Any Access (FCB compatibility mode)

                16      10h    Deny All

                32      20h    Deny Write

                48      30h    Deny Read

                64      40h    Deny None

 

Errors Posted: The same set of errors that may be posted by OPEN

Example:

ReadOnly    EQUATE(0)               !Access mode equates

WriteOnly   EQUATE(1)

ReadWrite   EQUATE(2)

DenyAll     EQUATE(10h)

DenyWrite   EQUATE(20h)

DenyRead    EQUATE(30h)

DenyNone    EQUATE(40h)

CODE

SHARE(Master,ReadOnly+DenyWrite)   !Open read only mode

 

See Also:

OPEN