How CMS Manages Files

CMS manages all files by continually updating various control blocks. Each accessed file mode is represented in storage by a control block called the Active Disk Table. This control block describes an accessed minidisk or SFS directory. Each open file is represented in storage by a control block called the Active File Table. This table contains the read and write pointers to a file, plus other status information related to the file. The File System Control Block (FSCB) is a user parameter list that holds information about an operation on a file. Here are some examples:
  • The record format, whether it is F-format or V-format, is information maintained in the FSCBRECF field. The default format, if you do not specify it for an operation, is F-format.
  • A record number is maintained in the FSCBAITN field. The record number is the relative number of the next record to be read or written. The default value for this field is 0 which, when you read a file, indicates that records are read sequentially. When you write information to an existing file, a 0 indicates that records are written sequentially following the last record in the file. When you write information to a new file, a 0 indicates that records are to be written at record 1.
  • A buffer address and size is maintained in fields FSCBBUFF and FSCBSIZE, respectively. When reading or writing records, you need to supply a buffer address where a record is to be read or written. The buffer needs to be large enough to accommodate the longest record you expect to read or write.
  • The number of records to be read or written is maintained in the FSCBANIT field. The default number of reads or writes for an operation is 1. This number can only be 1 for V-format files.
  • The actual number of bytes read is saved in the FSCBNORD field. If you are reading a variable-length file, you can use this information to determine the size of the record read.
  • A read pointer (FSCBRPTR) and a write pointer (FSCBWPTR) are saved after you open a file.