unlimited access to their own files and the files were not accessible to other users. Stage three allowed for "really shared files", where the $PERMIT command or the PERMIT subroutine can be used to share a file in a variety of ways with lists of other users, projects, all other users, or a combination of these. The types of access that can be allowed are read, write-extend, write-change or empty, renumber or truncate, destroy, and permit. As for stages one and two, by default a user file is permitted with unlimited access for its owner and no access for others. A file's owner's access can also be changed, although an owner always retains permit access. The $FILESTATUS command or FILEINFO and GFINFO subroutines can be used to obtain a file's permit status. Stage four added program keys (PKeys) to the list of things to which a file can be permitted. Thus files can be permitted to users, projects, all other users, program keys, or a combination of these. Program keys were associated with MTS commands and files, which allowed files to be permitted to specific programs or to specific MTS commands. Among other things this allowed the creation of execute-only or run-only programs in MTS. Files can also be permitted to the initial sub-string of a userID, projectID, or program key. As a result, it may happen that a single userID, projectID, and program key may potentially have more than one type of access. In such cases, the actual access is resolved according to the following rules: (i) userIDs, alone or in combination with program keys, take precedence over projectIDs and program keys, ii) projectIDs, alone or in combination with program keys, take precedence over program keys, (iii) longer sub-string matches take precedence over shorter sub-string matches, and (iv) if there is no specific userID, projectID, or program key match then the access specified for "others" is used. The PKEY subroutine can be used to shorten the program key of the currently running program or switch the program key of the currently running program to *EXEC and later restore the program key, allowing a program to voluntarily limit the access it has to files by virtue of its program key. File locking As part of "really shared files" (stage three above), file locking was introduced to control simultaneous access to shared files between active MTS sessions (that is, between separate