Accessing Directories

Another way to share files is by using the ACCESS command. Using this method, you would grant authority for a directory to another user, such as USERA. That user would then use the ACCESS command to use the directories and the files in it.

Once the directory is accessed, USERA can issue commands on that directory. By default, the CMS File System treats access to another user's directory as an access in read-only mode. (Otherwise, programs using STATEW would assume that they could create a new file on that directory.)

When you access directory control directory in read-only status, you cannot write to anything in the directory, even if you own the directory or have DIRWRITE authority to it. Commands, CSL routines, or macros that try to write to the directory will fail.

When you access a file control directory in read-only status, however, you can write to files in the directory if you are properly authorized. To write to the files, you can use CSL routines or a few CMS commands. Most CMS commands and assembler language macros require the directory to be accessed in read/write status. XEDIT and COPYFILE commands do not. You can use XEDIT to edit another user’s file in a directory that you have accessed read-only. You can also use COPYFILE. In either case, you must have WRITE authority to the file in order to write to it. To have XEDIT and COPYFILE respect the read-only access, use the SET RORESPECT ON command.

If you want to execute commands that require a read/write file mode, you can force another user's directory to be accessed in read/write status. To do so, specify the FORCERW option on the ACCESS command.

You can force a file control directory into read/write status even if you have only READ authority to the directory. Naturally, if you try to do something (such as creating a file) that requires WRITE authority, the operation will fail. You cannot circumvent SFS authority checking by forcing a read/write access.

When forcing a read/write access to a another user's file control directory, keep in mind that some programs may have compatibility problems. A program might, for example, assume that it can create new files when, in fact, the user has only READ authority on the directory.

Unlike file control directories, you cannot force a directory control directory into read/write status without being authorized to write. You must have DIRWRITE authority to the directory control directory or your attempt to force it into read/write status will fail. Because of this authorization requirement, forcing another user's directory control directory into read/write status does not cause program compatibility problems. Programs can safely assume that they can create or erase files in the directory, and that they can write to any file in the directory.

For more information on the FORCERW option on the ACCESS command, see z/VM: CMS Commands and Utilities Reference.