CMS Command Search Order

When you enter a command in the CMS environment, CMS has to locate the command to execute. If you have EXEC or MODULE files on any of your accessed disks or directories, CMS treats them as commands; they are known as user-written commands. For CMS to find an EXEC or MODULE file in an SFS directory, you must have read or write authority to the file.

As soon as the command name is found, the search stops and the command is executed. The search order is:

  1. Search for an exec with the specified command name:
    1. Search for an exec in storage. If an exec with this name is found, CMS determines whether the exec has a USER, SYSTEM, or SHARED attribute. If the exec has the USER or SYSTEM attribute, it is executed.

      If the exec has the SHARED attribute, the INSTSEG setting of the SET command is checked. Minidisks are searched for an exec with that name. (To find a file in a directory, read authority is required on both the file and directory.) If an exec is found, its file mode is compared to the file mode of the CMS installation saved segment. If the file mode of the saved segment is equal to or higher (closer to A) than the file mode of the directory or minidisk, the exec in the saved segment is executed. Otherwise, the exec in directory or on the minidisk is executed. However, if the exec is in a directory and the file is locked, the execution will fail with an error message.

    2. Search for a file with the specified command name and a file type EXEC on any currently accessed disk or directory. CMS uses the standard search order (A through Z). The table of active (open) files is searched first. An open file may be used ahead of a file that resides on a disk or directory earlier in the search order.
    3. To find a file in a directory, read authority is required on both the file and the directory. If the file is in a directory and the file is locked, the processing fails with an error message.
  2. Search for a translation or synonym of the specified command name. If found, search for an exec with the valid translation or synonym by repeating Step 1.
  3. Search for a module with the specified command name:
    1. Search for a nucleus extension module.
    2. Search for a module in the transient area.
    3. Search for a nucleus resident module.
    4. Search for a file with file type MODULE on any currently accessed minidisk or directory. The table of active (open) CMS files is searched first. An open file may be used ahead of a file that resides on a minidisk or directory earlier in the search order.
  4. Search for a translation or synonym of the specified command name. If found, search for a module with the valid translation or synonym by repeating Step 3.
Note: CMS will not search for an exec with the specified command name if SET IMPEX is OFF. For more information, see SET IMPEX.

When CMS searches for a translation or synonym (as in Steps 2 and 4), the translation and synonym tables are searched in the following order:

  1. User National Language Translation Table
  2. System National Language Translation Table
  3. User National Language Translation Synonym Table
  4. System National Language Translation Synonym Table
  5. CMS User Synonym Table
  6. CMS System Synonym Table
Note: For information about the National Language Translation tables (items 1-4), see the SET TRANSLATE command. For information about User and System Synonym tables (items 5-6), see the SYNONYM command.

If the search fails to find a CMS command, it is passed to CP for execution unless SET IMPCP is OFF. For more information, see SET IMPCP.