New Features of MPE/iX: Using the Hierarchical File System: 300 MPE/iX Computer Systems > Chapter 1 What's New on MPE/iX: TutorialLearning by Doing |
|
You can try some of the new features of MPE/iX with the examples in the rest of this tutorial. When you log on to the system, you are in a group within an account such as YOURGRP.YOURACCT. Files you work with, such as FILE1, can be referred to as FILE1.YOURGRP.YOURACCT or file1.yourgrp.youracct. MPE syntax automatically converts lowercase letters to uppercase. With the advent of the hierarchical file system, you can also refer to a file using the HFS syntax. That same file can be referred to as /YOURACCT/YOURGRP/FILE1. It is the path to the file or the pathname.
The first / in the pathname refers to the level above the account and is called the root directory. It is used as a way to reference files on the system. See Figure 1-2 “Location of the File That You Created”. Figure 1-2 “Location of the File That You Created” shows a picture of your file's location in the file system. YOURACCT is one level below the root directory. You logged on to YOURACCT and were placed into YOURGRP. Then you built a file called FILE1. Any other files that you have in YOURGRP are also located there with FILE1. You can refer to a file using either the MPE or HFS syntax. Earlier you created a file called FILE1.
You can list the file with MPE syntax:
OR (using the exact capitalization shown)
Both display the same result:
Be careful! HFS syntax is case sensitive but MPE syntax is not. You can type the following command, using MPE syntax in lowercase, and locate uppercase FILE1 in YOURGRP in YOURACCT. Try it.
That's because MPE syntax upshifts everything. But because HFS syntax is case sensitive, the following command will not find FILE1 in YOURGRP in YOURACCT:
YOURACCT is not the same as youracct in HFS syntax. A directory is a work area similar to an MPE group where you can put related files. You can create directories in your group and account. You must precede file and directory names with ./ or / to use HFS syntax. Dot (.) means current working directory or where you are working within the file system. So ./ lets you use HFS syntax in your current working directory.
This command creates Directory1 in your current working directory. HFS syntax accepts the name exactly as you type it in uppercase and lowercase, and the name can be up to 16 characters long when created directly under a group. (Refer to Table 1-2 shown previously for maximum lengths of directory names.) Watch out! If you try to create the directory without including ./ before the name, MPE/iX treats the name as a regular MPE name. It converts the letters to all uppercase. Try typing the following command:
Also notice: If you type the following command, MPE/iX creates a directory called DIR2 (uppercase). That is because you are using MPE syntax. Try it.
In the next section, you'll learn how to list the directory. Figure 1-3 “Location of the Directories That You Created” shows a picture of the file system including the directories that you just created. You use the LISTFILE command to list directories as well as files. Directories are special types of files.
You can tell that it's a directory (rather than a file) in the command output because its name is followed by a slash. To list all files and directories in your current working directory:
All files (including directories) in your current working directory are listed. If you omit the ./ from the command, the LISTFILE command assumes that you are looking only for MPE-named files, and HFS-named files are not displayed:
If you have other files in the group where you are working, they are listed along with FILE1. The result is the same if you omit @ and type LISTFILE since that is the default when no parameter is included with the command.
You can also use the LISTDIR UDC to list directories:
All the directories in your current working directory are listed when you specify the UDC with no parameters. You can also use the LISTDIR UDC to list directories in a specific location:
This command locates any directories located in PUB.SYS. After you create a directory, you can move to it.
This command moves you to Directory1. Figure 1-4 “Location after Changing Directories” shows you where you moved in the file system. Directory1 is now your current working directory. Again, use a ./ to act on HFS files. If you don't, MPE/iX acts only on MPE-named files. If you try to change to Directory1 without the preceding ./ the system treats the directory name as an MPE name and converts the letters to uppercase. It does not locate the directory.
According to MPE syntax, the file name is limited to eight characters, but actually, two errors occur here. First, the system discovers that the name is longer than eight characters and reports the error. Second, the name is upshifted, and the system looks for DIRECTORY1, which it wouldn't find even if it were fewer than eight characters. If you type
by itself, MPE/iX moves you back to your logon group. Try typing the command. Figure 1-5 “Moving Back to Your Logon Group” shows you where you are now. YOURGRP is your current working directory again. You can move to the DIR2 directory that you created earlier.
This command moves you to the directory called DIR2 since the MPE syntax rules are followed; these rules convert the name to uppercase. Notice when using HFS syntax, you can type the commands in uppercase or lowercase. Using lowercase is easier for some people. Otherwise, you can force specific case for a name by beginning the name with ./ as shown here. Since you have already changed directories, you'll need to change back to your logon group (using CHDIR) to try the following example:
Figure 1-6 “Moving to DIR2” shows you where you are now. DIR2 is your current working directory. You can also create a directory within a directory. The previous examples put you in the DIR2 directory. Now try creating another directory with a long name:
Using LISTFILE or the LISTDIR UDC is the best way to list directories and subdirectories.
Subdirectories can contain files or directories with names of up to 255 characters. Using LISTDIR also lists directories. The output is similar:
You change to subdirectories as well as directories using the CHDIR command:
CWD is short for current working directory. That's where you are located in the hierarchical file system. To find out your CWD, type the following command:
The location of the directory is presented from the root directory down to the current location in a pathname. The pathname is the path to the directory. Names are shown top-down rather than bottom-up. The first / refers to the root directory. All directories, accounts, and files exist under the root. Slashes separate the pathname components. The last component of the pathname is the name of the current working directory. You used to use the SHOWME command to find out your logon group. The SHOWME command does not show the current working directory, but you can change your prompt so that it shows where you are at all times.
Having your prompt set to the current working directory makes it obvious where you are as you move around in the hierarchical file system. The first command in the above example also saves your current prompt in case you want to return to it. Here's the command you use to reset your old prompt:
Move back to your logon directory:
Both MPE syntax and HFS syntax will work with your existing files or files with names conforming to MPE syntax. However, you must use HFS syntax to specify file names using HFS naming syntax (such as those using special characters or lowercase letters). The rest of the examples in this tutorial use the colon prompt rather than the name of the current working directory. Try each of these commands to copy an existing MPE file into DIR2:
Using the LISTFILE command with option 2 provides useful output. In the following example, the file type for the directories, DIR2 and Directory1, is DBH. This is a new type that indicates that these are directories in binary form and they are hierarchical (as opposed to being groups or accounts).
You can use many options with the LISTFILE command to show additional information about the files and directories. To delete Directory1:
MPE/iX deleted the directory because it was empty. (You need to use the TREE option with the PURGEDIR command to delete a directory that is not empty.) HFS syntax, like MPE syntax, allows the use of absolute pathnames and relative naming. An absolute pathname is a pathname where all components, starting with the root, are specified (for example, /SYS/PUB/CI). HFS syntax also allows the use of relative pathnames. A relative pathname allows you to specify a file by beginning from your CWD. For a relative pathname, start the name specification with a "./" (dot slash).
You can use the TREE option to show all accounts, groups, files and directories below the specified point.
Including a slash at the end of a directory name in the LISTFILE command is the same as specifying the keyword TREE in the command line.
This command shows all accounts, directories, and files on the system. (It replaces LISTF @.@.@.) In the command shown, the / does triple duty: first it tells MPE/iX to interpret the name using the HFS syntax; second, it calls the TREE option; and third, the / represents the root directory.
The above command shows all accounts, directories, and files exactly one level below root.
The above command shows all directories or files exactly four levels below the root directory. You can use the NAME option to look for an account, group, directory, or file.
This command searches for all directories, accounts, groups, and files on the system that begin with D (or d). It searches through all levels of the file system hierarchy. In the MPE account structure prior to Release 4.5 (when there were only three levels), the following command sequence would have been used:
You can still use the above LISTF commands to locate files beginning with D, groups beginning with D, and accounts beginning with D, respectively. However, the commands only locate files in groups. Files beginning with D in directories are not located. No directories are listed, and no files with names having lowercase letters are found using LISTF. |