| **Navigation:**  [[introduction.htm|Language Reference]] > App E - Legacy Statements >====== SHARE (open data file for shared access) {{c6h0007.jpg|C6H0007.jpg}} ====== | [[pointer return relative record position .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[tcpip appendixf.htm|{{btn_next_n.gif|Next page}}]] | | || **SHARE(**//file// [,//access mode//]**)** {{blk2blue.jpg|blk2blue.jpg}} | **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 open a data structure .htm|OPEN]]