March 30, 1979 Filemode 2: Filemode 2 is essentially the same, for the purposes of reading-and writing files, as filemode 1. Usually a filemode of 2 is assianed to files that are shared by users who link to a common disk, likeJthe system disk. Since you can access a disk and specify which files on that disk you want to access, files with a filemode of 2 provide a convenient subset of all files on a disk. For example, if you issue the command: access 489 e/a * * e2 you can only read files with a filemode of 2 on the disk at virtual address 489. J: Files with a filemode of 3 are erased after they are read. If you create a file with a filemode of 3 and then request that it be printed, the file is printed, and then erased. You can use this file.ode if you write a program or EXEC procedure that creates files that you do not want to maintain copies of on your virtual disks. You can create the file,-print it, and not have to worry about erasing it later. The language processors and some CMS commands create work files and give these work files a file mode of 3. Note: A filemode of 3 should not be used with EXECs. Depending on what commands are issued within it, an EXEC with a filemode of 3 may be erased before it completes execution. Files with a filemode of 4 are in as simulated data set format. These files are created by as macros in running in CMS. You specify that a file created by a program to have OS simulated data set format by specifying a filemode of 4 when you issue the FILEDEF command for output file. you QO not specify a filemode of 4, the output file is created in CMS format. You can find more details about as simulated data sets in "Section 8. Developing as programs Under CMS." !gte: There are no filemode numbers reserved for DOS or VSAM data sets, since CMS does not simulate these file organizations. Filemode 5: This filemode number is the same, for purposes of reading as filemode 1. You can assign a filemode of 5 to files that you want to maintain as logical groups, so that you can manipulate thea in groups. For example, you can reserve the filemode of 5 for all files that you are retaining for a certain period of time; then, when you want to erase them, you could issue the command: erase * * as You can assign filemode numbers when you use the following commands: COPYFILE: You can assign a filemode number when you create a new file wIth-the COPYFILE command. To change only the filemode number of an existing file, you must use the REPLACE option. For exaaple: copy file test module a1 = = a2 (replace changes the filemode number of the file TEST MODULE A from 1 to 2. Section 4. The CMS File System 55
March 30, 1979 Filemode 2: Filemode 2 is essentially the same, for the purposes of reading-and writing files, as filemode 1. Usually a filemode of 2 is assianed to files that are shared by users who link to a common disk, likeJthe system disk. Since you can access a disk and specify which files on that disk you want to access, files with a filemode of 2 provide a convenient subset of all files on a disk. For example, if you issue the command: access 489 e/a * * e2 you can only read files with a filemode of 2 on the disk at virtual address 489. J: Files with a filemode of 3 are erased after they are read. If you create a file with a filemode of 3 and then request that it be printed, the file is printed, and then erased. You can use this file.ode if you write a program or EXEC procedure that creates files that you do not want to maintain copies of on your virtual disks. You can create the file,-print it, and not have to worry about erasing it later. The language processors and some CMS commands create work files and give these work files a file mode of 3. Note: A filemode of 3 should not be used with EXECs. Depending on what commands are issued within it, an EXEC with a filemode of 3 may be erased before it completes execution. Files with a filemode of 4 are in as simulated data set format. These files are created by as macros in running in CMS. You specify that a file created by a program to have OS simulated data set format by specifying a filemode of 4 when you issue the FILEDEF command for output file. you QO not specify a filemode of 4, the output file is created in CMS format. You can find more details about as simulated data sets in "Section 8. Developing as programs Under CMS." !gte: There are no filemode numbers reserved for DOS or VSAM data sets, since CMS does not simulate these file organizations. Filemode 5: This filemode number is the same, for purposes of reading as filemode 1. You can assign a filemode of 5 to files that you want to maintain as logical groups, so that you can manipulate thea in groups. For example, you can reserve the filemode of 5 for all files that you are retaining for a certain period of time; then, when you want to erase them, you could issue the command: erase * * as You can assign filemode numbers when you use the following commands: COPYFILE: You can assign a filemode number when you create a new file wIth-the COPYFILE command. To change only the filemode number of an existing file, you must use the REPLACE option. For exaaple: copy file test module a1 = = a2 (replace changes the filemode number of the file TEST MODULE A from 1 to 2. Section 4. The CMS File System 55
Pg. of GC20-1819-2 Rev March 30, 1979 by Supp. SD23-9024-1 for 5748-XX8 You can assign a filemode number when you create a file with the CMS editor. To change the filemode number of an existing file, use the RENAME or COPYFILE commands, or use the FMODE subcommand when you are in the edit environment. fIL!Q!f: When you assign file definitions to disk files for programs or CMS command functions, you can specify a filemode number. §!NMQQ: You can specify a filemode number on the GENMCD command line. To change the filemode number of an eXisting file, use the RENAME or COPYFILE commands. READCARD: You can assign a filemode number when you specify a file IdentIfIer on the READCARD command line or on a READ control card. RENAME: When you specify the fileids on the RENAME command, you can specIfy the filemode numbers for the input and/or output files. You can specify filemode numbers for the input and/or output fileids on the SORT command line. Managing Your CMS Disks The number of files you can write on a CMS disk depends on both the size of the disk and the size of the files that it contains. You can find out how much space is being used on a disk by using the QUERY DISK command. For example, to see how much space is on your A-disk, you would enter: query disk a The response may be something like this: LABEL cuu M STAT eYL TYPE BLKSIZE 191 A R/i 5 3330 1024 FILES ELKS USED-(%) ELKS LEFT ELK TOTAL 171 1221-92 107 1328 When a disk is becoming full, you should erase whatever files you no longer need. Or dump to tape files that you need to keep but do not need to keep active on disk. When you are executing a command or program that writes a file to disk, and the disk becomes full in the process, you receive an error message, and you have to try to clear some space on the disk before you can attempt to execute the command or program again. To avoid the delays that such situations cause, you should try to maintain an awareness of the usage of your disks. If you cannot erase any more files from your disks, you should contact installation support personnel about obtaining additional read/write disk space. CMS File Directories Each disk has a master file directory that contains entries for each of the CMS files on the disk. When you access a disk, information frem the master file directory is brought into virtual storage and written into a user file directory. The user file directory has an entry for each file that you may access. If you have accessed a disk specifying only particular files, then the user file directory contains entries only for those files. 56 IBM VM/370 CMS User's Guide
Page of GC20-1819-2 As Updated April 27, 1981 by TNL SN25-0828 For 5748-XE1 If you have read/write access to a disk, the master file directory and the user file directory are updated to reflect the current status of the disk each time you write the file onto disk. Only the master file directory, however, is updated if there are no open files on the disk, and only the user file directory is updated when an FSCLOSE macro command is issued. with read-only access to a disk, you cannot update the master file directory or the user file directory; however, if another user is writing files onto the disk, you can obtain an updated copy of the master file directory by issuing the ACCESS command for the disk. 1:!Q.te: You should never attempt to write on a disk at the same time as another user. The user file directory remains in virtual storage until you issue the RELEASE command specifying the mode letter or virtual address of the disk. If you detach a virtual disk (with the CP DETACH command) without releasinq it, CMS does not know that the disk is no longer part of your virtual machine. When you attempt to read or write a file on the disk CMS assumes that the disk is still active (because the user file directory is still in storage) and encounters an error when it tries to read or write the file. A similar situation occurs if you detach a disk and then add a new disk to your virtual machine using the same virtual address as the disk you detached. For example, if you enter the following sequence of commands: cp link user1 191 195 rr rpass 1 access 195 d cp detach 195 cp link user2 193 195 rr rpass2 1 listfile * * d the LISTFILE command produces a list of the files on USER1's 191 disk; if you attempt to read one of these files, you receive an error message. You must issue the ACCESS command to obtain a copy of the master file directory for USER2's 193 disk. The entries in the master file directory are sorted alphamerically by filename and filetype, to facilitate the CMS search for particular files. When you are updating disk files, the entries in the user file directory and master file directory tend to become unsorted as files are created, updated, and erased. When you use the RELEASE command to release a read/write disk, the entries are sorted and the master file directory is rewritten. If you or any other user subsequently access the disk, the file search may be more efficient. CMS Command Search Order When you enter a command line 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, CMS treats them as commands; also, they are known as user-written commands. INote that the password cannot be entered on the command line if the password suppression facility was specified at sysgen. Section 4. The CMS File System 57
April 1, 1981 If there are files named MYFILE ASSEMBLE on your A-disk and C-disk, then only copv on your A-disk is displayed. The commands that perform this type of search are: DISK DUMP EDIT FILEDEF PRINT PUNCH RUN SORT STATE SYNONYM TAPE DUMP TYPE For the COMPARF, COPYFILE, RENAME, and SORT commands, you must always specify a filemode letter, even if it is specified as an asterisk. WHEN TO FILEMODE LETTERS: WRITING FILES When you issue a CMS command that writes a file onto one of your virtual lnd you specify the output filemode, CMS writes the file onto that di3K. commands that require you to specify the output filemode are: COPYFILE RENAME SORT The commands that allow you to specifv,the output filemode, but do not require it, are: FILEDEF TAPE LOAD TApoDS UPDATE When VOl do not specify the filemode on these commands, :MS writes the outout files onto your A-disk. Same commands that create files always write them onto your A-disK. The and INCLUDE commands write a file named LOAD MAP AS. The LIsrFILE command creates a file named CMS EXEC, on your A-disk. The CMS/DOS commands DSERV, ESERV, SSEFV, PSERV, and RSERV also write files onto your A-disk. Other that do not allow you to specify the filemode, write output riles either: • To the disk from which the input file was read, or • Ta A-disk, if the file was read from a read-only disk These commands are: MA:LIB TXTLIB The command also functions this way if you specify the output filemode as an asterisK (*). In lddition, many of the lanquage processors, when creating worK files and permanent files, write onto the first read/write disk in your search ard9r, if they cannot write on the source file's disk or its parent. 54 IBM VM/370 eMs User's Guide
Paae of GC20-1819-2 As Updated April 1, 1981 by TNt GN25-0826 Haw FILEMODE PryMBERS ARE USED Whenever you specify a filemode letter to reference a file, you can also specify a filemode number. Since a filemode number for most of your files is 1, you do not need to specify it. The filemode numbers 0, 2, 3, and 5 are discussed below. Filemode numbers 6 through 9 are reservej for use. Filemode Q: A filemode number of 0 assigned to a file makes that file other user may access it unless they have read/write access to :1isk. If someone links to your disk. in read-only mode and reauests a of all the on your disk, the files with a filemode of 0 are not listed. A user with read/share password, however, can link to a minidisk and, using the DDR proqram, can copy the disk and its nrivate files (filemode 0). section The C"S File System 54.1