The FILES Command in MS-DOS 6.22 Explained

In MS-DOS 6.22, the FILES statement is a system configuration command placed in the CONFIG.SYS file that determines the maximum number of files the operating system can access concurrently. By allocating memory for system-level file handles, this setting prevents "Too many files open" errors during multitasking or when running complex programs like databases and compilers. Balancing this number is critical for system stability and performance, as allocating too few causes program crashes, while allocating too many wastes valuable conventional memory.

Purpose of the FILES Statement

When MS-DOS opens a file, it creates an internal data structure known as a file table entry to track the file's status, location on disk, and access permissions. The FILES directive establishes the total size of this internal table for the entire operating system, setting a global cap on open file handles across all active processes.

Syntax and Values

The statement is configured in the root directory's CONFIG.SYS file using the following syntax:

FILES=x
  • x: Represents the number of files, with an allowable range from 8 to 255.
  • Default Value: If no FILES line is included in CONFIG.SYS, MS-DOS 6.22 defaults to 8.

The default value of 8 is insufficient for most software written for MS-DOS. Standard usage guidelines include:

  • General Use and Gaming: A value of 30 or 40 (FILES=30 or FILES=40) is typically recommended for standard DOS environments, providing adequate headroom for most productivity suites and games.
  • Database Applications: Programs such as dBASE, Clipper, or FoxPro frequently open multiple indices, data tables, and temporary files simultaneously, often requiring settings of 50 to 99.
  • Windows 3.1x on DOS 6.22: Running Windows in 386 Enhanced Mode on top of MS-DOS usually requires at least FILES=30 to avoid file-sharing and execution faults.

Memory Overhead

Each file handle reserved beyond the default minimum consumes conventional RAM (the lower 640 KB):

  • Each additional file handle above 8 consumes approximately 48 to 64 bytes of memory.
  • While individual handles use little memory, setting the value to the maximum of 255 permanently locks several kilobytes of conventional memory that could otherwise be used to run executable programs.
  • To optimize memory, users should set the value only as high as required by their most demanding software, or use memory managers like HIMEM.SYS and EMM386.EXE with DOS=HIGH,UMB to minimize conventional memory usage.

Resolving "Too Many Files Open"

If an application attempts to access more files than allowed by the current configuration, MS-DOS terminates the operation and returns the error message:

Too many files open

To resolve this issue, open C:\CONFIG.SYS using the MS-DOS Editor (EDIT CONFIG.SYS), locate the FILES= line, increase the numerical value (for example, from 20 to 40), save the changes, and restart the computer for the new limit to take effect.