How Extensions Are Used

You can also access file modes as logical extensions of other file modes; for example:
access 235 b/a
The B/A indicates that file mode B is to be a read-only extension of file mode A; file mode A is considered the parent of file mode B. A file mode may have many extensions, but only one level of extension is allowed.
If you have a minidisk accessed as an extension of a file mode, the extension is automatically read-only, and you cannot write on it. Therefore, you might access a minidisk as its own extension to protect the files on it from being accidentally overwritten. For example:
access 235 b/b

For SFS, accessing a directory as read-only restricts writing to files in that directory for all commands that use file modes, even if you are properly authorized to write to the files. The only exceptions to this are for directories with the file control (FILECONTROL) attribute. With FILECONTROL directories, you can create an alias to a file (with the CREATE ALIAS command), and write to the file using the COPYFILE and XEDIT commands, even if you have the directory accessed in read-only status. Of course, you must have the proper authorization to write to the file. To have XEDIT and COPYFILE respect the read-only access, use the SET RORESPECT ON command.

To protect a file in an SFS directory from being overwritten, you may want to create a lock. A SHARE lock will allow the owner, as well as other users, only the ability to read the file. To change the file, the owner must enter the DELETE LOCK command. For more information on locking files, see Locking Files and Directories.

Another use of file extensions is to extend the CMS search order. If you enter a command request to read a file, for example:
type alpha plan
CMS searches file mode A for the file named ALPHA PLAN and if it does not find it, searches any extensions to file mode A. If you have a file named ALPHA PLAN on file mode B, but have not accessed it as an extension of file mode A, CMS will not find the file, and you will have to re-enter the command:
type alpha plan b
Some commands, however, handle file mode extensions differently. The TYPE command defaults to a file mode of A. Therefore, in the example above, when you did not specify a file mode, CMS would search only file mode A and all extensions of file mode A. For more information on the search order for specific commands, see z/VM: CMS Commands and Utilities Reference.

Note that if you specify a file mode of asterisk (*), or if a particular command defaults to a file mode of asterisk, CMS uses the standard search order (A through Z, without regard to any extensions you have defined). For example, if a certain file was on your file mode W, which you had previously defined as an extension of file mode A (W/A), CMS would alphabetically search file mode A, followed by file mode B, and any remaining file modes until it reached file mode W, where the file would be found.

The same applies for commands that search for a file based on a default file type, such as the LOAD command, which defaults to a file type of TEXT. Because these commands usually have a default file mode of asterisk, CMS would use the standard search order.

Additionally, for some CMS commands that read and write a file, if you enter the command, and the file to be read is on an extension of a file mode having read/write status, the output file is written to the parent read/write file mode. The COPYFILE command is a good example of this type of command. If you have a file, named FINAL LIST, on file mode B extension of a read/write file mode A, and if you want to make a copy of the file with a different name, enter:
copyfile final list a final newlist a
After the command is completed, the duplicate exists on file mode A. The file on file mode B remains unchanged.