Using HP 3000 MPE/iX:\Advanced Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 3 Module 2: File ManagementLesson 2 Building Disk Files |
|
You have had a brief introduction to different types of files: permanent, temporary, and formal. In lesson 2, you will learn how to use the BUILD command and the following options to create customized files:
The BUILD command is useful when you need to change the file's format so that another program or subsystem can accept the format. For example, using the editor, you can only display and edit files that contain data in a particular format. If you "inherit" a file from another system, it may not be in the correct format. For example, suppose that you enter the command:
This command generates a temporary file called LISTFILE. The > causes MPE/iX to put the display from this command into a temporary file.
The BUILD command allows you to specify the "shape" of a file that as yet contains no information. Using BUILD is much like creating a container into which liquid will be poured; the contents will conform to the dimensions of the container. In the BUILD situation, data will conform to the characteristics of the empty file created by the BUILD command. The following illustration shows how the data in a file will take on the characteristics of its "container." Generally speaking, as a general user, you are not so much concerned with the characteristics of a file, as with the data in it. Usually, the subsystem that you are using (for example, some editor) automatically creates files with the appropriate characteristics that determine how the contents are stored on disk. As you become a more experienced user, you may become concerned with how to make programs run most efficiently by defining a file's characteristics more precisely. Although you cannot alter the physical characteristics of an existing file, you can create a new file with the desired characteristics (using BUILD) and then copy the contents of the existing file into the new one (using FCOPY). The new file contents then have the appropriate characteristics. The FCOPY command is covered in module 4, File Transfer. The BUILD command builds a new file. The options associated with the BUILD command determine the physical characteristics of the file. Partial syntax for the BUILD command appears below. The complete syntax and option explanation can be viewed in the MPE/iX Commands Reference Manual Volumes 1 and 2 (32650-90003 and 32650-90364) or in the online help facility.
Consider a file that already exists. View the various characteristics specified by the BUILD command. Enter this command:
All questions about the BUILD command options refer to the display that you now see on the screen.
You've already worked with passwords at the account, group, and user level. MPE/iX provides a further level of security, lockwords. These are file "passwords," which restrict access to a particular file. This means that even if you know the account, group, and user passwords, you will not be able to access a particular file unless you know the lockword. When using the BUILD or RENAME command, use a forward slash (/) to delimit the lockword. The slash is not part of the lockword.
For example, suppose you build a file called SECRETS:
Whenever you try to view SECRETS, you must also specify the lockword, KEY.
For example, suppose that you accidentally type:
You may think you have a file called MYFILE; however, the system interprets a file called MY with a lockword of FILE. Record size refers to the number of bytes or words per record. Record size is important because certain applications can read only records of a certain size. You may find that if a file has records of a different size, you will not be able to display or edit that file. This record size may vary according to the utility or program that created the file. For example, a file created with the editor will have a different record size than one created by LISTFILE > filelist. A positive record size indicates the number of two-byte words in the record. A negative record size indicates the number of bytes in the record.
This option is a holdover from a previous operating system, MPE V. At one time, the blocking factor was used to determine the number of logical records for each physically configured block. The more logical records per block, the more densely the data was packed. This helped to conserve space; however, blocking is rarely used on MPE/iX, so the blocking factor is usually allowed to default.
For files with variable-length records, the blocking factor always equals one.
Records are either fixed-length (length is a specific number of words or bytes), variable length (length changes with the data), or undefined. Generally speaking, editors can only read and work with fixed-length records.
Text files that you can view and edit tend to be ASCII. Executable program files and graphics files tend to be binary. In the next lesson you will have an opportunity to create some binary files.
There are several other options that you may occasionally wish to specify in the BUILD command:
********** End of Exercise 2-2 ********** |