Access Mode / Open Mode

 DOS version 3.0 added networking and file-locking capabilities to the DOS
 file system.  The additional complications will normally affect only those
 programs which expect to be used in a network environment.

                ┌─────────────────────────────────────────┐
                │  DOS 2.x (non-networking) Access Modes  │
                ├─────────────────────────────────────────┤
                │ 00H = open for reading                  │
                │ 01H = open for writing                  │
                │ 02H = open for both reading and writing │
                └─────────────────────────────────────────┘

 DOS 3.0+ is upwardly compatible with previous versions.  The Access/Open
 Mode is treated as a set of bit-flags:

 OpenModeRec
  ╓7┬6┬5┬4┬3┬2┬1┬0╖
  ║ishare│0│ r/w ║
  ╙╥┴─┴─┴─┴─┴─┴─┴─╜ bits mask
   ║ ╚═╦═╝   ╚═══╩═► 0-2: 03H Network Access Rights required for access
   ║   ║                       000 = read
   ║   ║                       001 = write
   ║   ║                       010 = read and write
   ║   ╚═══════════► 4-6: 70H Sharing Mode:
   ║                           000 = compatibility mode            00H
   ║                           001 = deny read/write(exclusive)    10H
   ║                           010 = deny write                    20H
   ║                           011 = deny read                     30H
   ║                           100 = deny none                     40H
   ╚═══════════════►   7: 80H Inheritance:
                               1 = file is private to this process 80H
                               0 = inherited by spawned processes

   Notes: ■ If the file attribute indicates Read-Only, then it overrides
            these flags.

          ■ The Network Access Rights and Sharing Mode bits have an effect
            if the DOS SHARE program has been installed or other file
            sharing support is installed.

          ■ The DOS 4.0+ Fn 6cH uses this mode byte as the low-byte of an
            Extended Open Mode word.  It provides flags that let you avoid
            critical errors and force disk-caching write-through.

See Also: Handle-Oriented File I/O
          fn 3dH (open file)
          fn 5cH (lock)
          DOS Functions
                                    -♦-