Learning by Doing [ New Features of MPE/iX: Using the Hierarchical File System ] MPE/iX 5.0 Documentation
New Features of MPE/iX: Using the Hierarchical File System
Learning by Doing
You can try some of the new features of MPE/iX with the examples in the
rest of this tutorial.
Use the HFS syntax
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.
NOTE To refer to an MPE file name using the HFS syntax, you must type
the name using all capital letters; otherwise, the HFS syntax looks
for the name using lowercase letters and won't locate it. HFS
syntax does not convert lowercase letters to uppercase.
/YOURACCT/YOURGRP/FILE1 = FILE1.YOURGRP.YOURACCT
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 .
Figure 1-2. Location of the File That You Created
Figure 1-2 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.
List the file
You can refer to a file using either the MPE or HFS syntax. Earlier you
created a file called FILE1.
NOTE The use of the LISTFILE command in this section is intentional.
The LISTF command does not recognize HFS syntax.
You can list the file with MPE syntax:
:LISTFILE FILE1.YOURGRP.YOURACCT
OR (using the exact capitalization shown)
:LISTFILE /YOURACCT/YOURGRP/FILE1
Both display the same result:
FILE1
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.
:listfile file1.yourgrp.youracct
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:
__________________________________________________________________
| |
| |
| :listfile /youracct/yourgrp/file1 |
| A component of the pathname does not exist. (CIWARN 9053) |
| |
__________________________________________________________________
YOURACCT is not the same as youracct in HFS syntax.
Create a directory
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.
:NEWDIR ./Directory1
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:
__________________________________________________________________
| |
| |
| :NEWDIR Directory1 |
| File name is more than eight characters long. (CIERR 532) |
| |
__________________________________________________________________
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.
:NEWDIR dir2
In the next section, you'll learn how to list the directory.
Figure 1-3 shows a picture of the file system including the
directories that you just created.
Figure 1-3. Location of the Directories That You Created
List the directories
You use the LISTFILE command to list directories as well as files.
Directories are special types of files.
_______________________________________
| |
| |
| :LISTFILE ./Directory1 |
| |
| |
| PATH=/YOURACCT/YOURGRP/./ |
| |
| Directory1/ |
| |
_______________________________________
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:
__________________________________________
| |
| |
| LISTFILE ./@ |
| |
| |
| PATH=/YOURACCT/YOURGRP/./ |
| |
| DIR2/ Directory1/ FILE1 |
| |
__________________________________________
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:
_______________________________________
| |
| |
| :LISTFILE @ |
| |
| FILENAME |
| |
| DIR1 |
| FILE1 |
| |
_______________________________________
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.
List directories another way
NOTE You can only use the system-provided UDCs, such as LISTDIR, if the
system manager has activated them. Refer to the section "UDCs,
JCL, Command Files, and Programs" in Chapter 3 for more
information.
You can also use the LISTDIR UDC to list directories:
_______________________________________
| |
| |
| :LISTDIR |
| |
| /YOURACCT/YOURGRP/DIR2/ |
| /YOURACCT/YOURGRP/Directory1/ |
| |
_______________________________________
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:
:LISTDIR /SYS/PUB
This command locates any directories located in PUB.SYS.
Move to the directory
After you create a directory, you can move to it.
:CHDIR ./Directory1
This command moves you to Directory1. Figure 1-4 shows you where you
moved in the file system. Directory1 is now your current working
directory.
Figure 1-4. Location after Changing Directories
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.
__________________________________________________________________
| |
| |
| :CHDIR Directory1 |
| |
| File name is more than eight characters long. (CIERR 532) |
| |
__________________________________________________________________
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.
Move back to your logon group
If you type
:CHDIR
by itself, MPE/iX moves you back to your logon group. Try typing the
command. Figure 1-5 shows you where you are now. YOURGRP is your
current working directory again.
Figure 1-5. Moving Back to Your Logon Group
Move to DIR2
You can move to the DIR2 directory that you created earlier.
:chdir dir2
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:
:chdir
:chdir ./DIR2
Figure 1-6 shows you where you are now. DIR2 is your current working
directory.
Figure 1-6. Moving to DIR2
Create a subdirectory
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:
:newdir ./Long_Directory_Name
NOTE HFS syntax allows you to use special characters in the name, such
as "_" (underscore). You can also use characters like the "-"
(hyphen) and "." (period or dot). By convention, the dot in a name
is usually used to separate the name from an extension that has
some significance. For example, names of source programs written
in the C language often have a .c extension such as prog1.c.
List the subdirectory
Using LISTFILE or the LISTDIR UDC is the best way to list directories and
subdirectories.
_______________________________________
| |
| |
| :listfile ./@ |
| |
| |
| PATH=/YOURACCT/YOURGRP/DIR2/./ |
| |
| Long_Directory_Name/ |
| |
_______________________________________
Subdirectories can contain files or directories with names of up to 255
characters.
Using LISTDIR also lists directories. The output is similar:
______________________________________________________
| |
| |
| :listdir |
| /YOURACCT/YOURGRP/./DIR2/Long_Directory_Name/ |
| |
______________________________________________________
Move to the subdirectory
You change to subdirectories as well as directories using the CHDIR
command:
:chdir ./Long_Directory_Name
Show where you are
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:
___________________________________________________________
| |
| |
| :showvar hpcwd |
| HPCWD = /YOURACCT/YOURGRP/DIR2/Long_Directory_Name |
| |
___________________________________________________________
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.
Change your prompt to show 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.
NOTE Do not execute the following command unless you want to change your
existing prompt.
____________________________________________________
| |
| |
| :setvar save_prompt hpprompt |
| :setvar hpprompt "!!HPCWD:" |
| /YOURACCT/YOURGRP/DIR2/Long_Directory_Name: |
| |
____________________________________________________
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:
:setvar hpprompt save_prompt
Create a file with a long file name
Move back to your logon directory:
_________________________________________________________
| |
| |
| /YOURACCT/YOURGRP/DIR2/Long_Directory_Name:chdir |
| /YOURACCT/YOURGRP: |
| |
_________________________________________________________
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:
___________________________________________________
| |
| |
| :COPY FILE1.YOURGRP.YOURACCT, |
| /YOURACCT/YOURGRP/DIR2/VeryLongFilename |
| : |
| |
| :COPY /YOURACCT/YOURGRP/FILE1, |
| /YOURACCT/YOURGRP/DIR2/AnotherLongFilename |
| : |
| |
___________________________________________________
List files and directories in your CWD
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).
____________________________________________________________________
| |
| |
| :listfile /YOURACCT/YOURGRP/@,2 |
| |
| PATH=/YOURACCT/YOURGRP/ |
| |
| CODE ------------LOGICAL RECORD----------- ----SPACE---- |
| FILENAME |
| SIZE TYP EOF LIMIT R/B SECTORS #X MX |
| |
| 128W FB 0 1023 1 0 0 * |
| AnotherLongFilename |
| 16W DBH 4 67107839 1 32 1 * |
| DIR2/ |
| 16W DBH 4 67107839 1 32 1 * |
| Directory1/ |
| 80B FA 411 411 1 144 2 * |
| FILE1 |
| 128W FB 0 1023 1 0 0 * |
| VeryLongFilename |
| |
____________________________________________________________________
You can use many options with the LISTFILE command to show additional
information about the files and directories.
Delete a directory
To delete Directory1:
_________________________________________________________
| |
| |
| :purgedir ./Directory1 |
| Directory "./Directory1" to be purged? (Yes/No)y |
| |
_________________________________________________________
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.)
Learn about absolute and relative pathnames
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).
1. Make sure that you are working in /YOURACCT/YOURGRP by issuing the
following command:
:chdir
(You can use CHDIR to move to a group because accounts and groups
are special types of directories.)
2. Now try the following command:
:LISTFILE /YOURACCT/YOURGRP/@,6
The command says, "list everything in /YOURACCT/YOURGRP." It
specifies the absolute pathname. Notice the output.
3. Try this command, which uses the relative pathname "./":
:LISTFILE ./@,6
The command says, "list everything in the current working
directory." Like the last command, it also lists the contents of
/YOURACCT/YOURGRP because you are currently working in that
directory.
Try a few more LISTFILE commands
You can use the TREE option to show all accounts, groups, files and
directories below the specified point.
:LISTFILE /YOURACCT;TREE
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.
:LISTFILE /YOURACCT/
List sets of objects on the system
:LISTFILE /
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.
:LISTFILE /@
The above command shows all accounts, directories, and files exactly one
level below root.
:LISTFILE /@/@/@/@
The above command shows all directories or files exactly four levels
below the root directory.
Search for files
You can use the NAME option to look for an account, group, directory, or
file.
:LISTFILE /,6; NAME=D@
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:
LISTF D@.@.@
LISTF @.D@.@
LISTF @.@.D@
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.
MPE/iX 5.0 Documentation