Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Working with FilesLesson 6 Copying Files |
|
Lesson 6 presents the commands needed to copy files.
To copy a file, use the COPY command, specifying the name of the file that you want to copy and the name that you want the new, identical copy to have. First you must be in the group in which the file is found. Enter:
LISTFILE DOCUMENT.@,6Return
Find the group in which the file called DOCUMENT is located. If necessary, use CHGROUP to move into that group. To make a copy of DOCUMENT, calling the new copy ANEWDOC, do this:
COPY FROM=DOCUMENT;TO=ANEWDOCReturn
Here is what the parameters do:
Use LISTFILE to verify that a new file called ANEWDOC appears. Use PRINT to look at the file:
PRINT ANEWDOCReturn
The COPY command permits you to shorten the command line a little. You can leave out ;FROM= and ;TO=. Do this:
COPY DOCUMENT,OLDDOCReturn
Use LISTFILE to be certain that a new file called OLDDOC now appears. COPY DOCUMENT,OLDDOC is the same as COPY FROM=DOCUMENT;TO=OLDDOC.
You used COPY the first time to create a new file, a duplicate of the source file. Suppose that you now try to copy the file ANEWDOC back to the original called DOCUMENT. The source becomes the destination, and the destination becomes the source of the COPY operation. Enter this:
COPY FROM=ANEWDOC;TO=DOCUMENTReturn
or enter this:
COPY ANEWDOC,DOCUMENTReturn
Do you see something like this on the screen: PURGE OLD DOCUMENT.MYGROUP.ANYACCT? The file DOCUMENT already exists. The computer needs instruction from you. Copying from one file to an already existing file implies the destruction of the destination file. In order to copy ANEWDOC into the existing file DOCUMENT, the computer must do this:
This process is called overwriting. Before doing that, the computer needs instructions from you. What to do:
This time, answer NO. This prevents the overwriting. You should see this on the screen: :PURGE OLD DOCUMENT.MYGROUP.ANYACCT? NO NO COPY WAS DONE (CIERR 9113) : Use COPY again, just as you did above, but this time, answer YES to the prompt. When you do that, you should see this on the screen: :COPY FROM=ANEWDOC;TO=DOCUMENT PURGE OLD? DOCUMENT.MYGROUP.ANYACCT? (Y/N) YES : Make sure that you are in your home group. Enter:
CHGROUPReturn
Do this: Use LISTFILE to find the file names in the group that you are in, in the PUB group, and in some OTHERGRP (your third group). To get a feeling for what you can and cannot do with COPY (at your current level of experience and authority), try some experiments:
You should succeed at the first three. The fourth copying task should produce an error message. That is because the file you are trying to copy from the third group into your current group has not been released for copying. The MPE/iX command that removes the security provisions for a file is RELEASE. Use CHGROUP to get into your OTHERGRP group. Use the editor to create a small text file called TEST. Write in it anything that you like. Then save the file and exit the editor. To remove the security provisions of the file TEST, enter:
RELEASE TESTReturn
To copy a file from another group to the group that you are in:
or
or
Do this:
COPY DOCUMENT.MYGROUP,DOCUMENTReturn
Group security allows you to copy a file from your home group into your current group, without first having to release the file. You also do not need to specify the name of the group you are currently in if the files is to be duplicated in that group. Now use CHGROUP to return to MYGROUP: Enter:
CHGROUPReturn
Then enter this:
COPY TEST.OTHERGRP,TESTReturn
Use LISTFILE to check to see that a copy of TEST now appears in MYGROUP. The copying worked this time because you had previously used the RELEASE command to remove normal security from the file TEST. MPE/iX makes assumptions when you copy files. MPE/iX assumes that the file that you want to copy is in your current group. If you want to copy a file from another group, you must specify the partly qualified file name (filename.groupname). MPE/iX assumes that you want the copy of the file to reside in your current group. In the example above, MPE/iX knows that you are logged on to MYGROUP. So, unless you specify otherwise, it assumes that you want the copy of TEST to reside in MYGROUP. The command above could just as easily be accomplished with this form: COPY TEST.OTHERGRP, TEST The effect would be just the same. A copy of TEST would appear in MYGROUP. Try it with another file in your group OTHERGRP. MPE/iX also assumes when you copy a file from another group that you want the file in your current group to have the same name. COPY TEST.OTHERGRP puts a copy of TEST into MYGROUP. The copy created in MYGROUP is also called TEST. You can use COPY to copy a file from one group to another group and give it a new name in the destination group. Do this:
COPY TEST.OTHERGRP,TEST2Return
The computer puts a copy of TEST from OTHERGRP into MYGROUP and calls the copy TEST2. In this case, MPE/iX assumes once again that you want the copy of the file in your current group; but, because you specified a new file name, COPY gives that name to the copy it put into MYGROUP. Try copying in the other direction now. Do this:
COPY TEST2,TEST3.OTHERGRPReturn
Do you get an error message? You should.
PUB is a special case of account security (Figure 5-1). Files in the PUB group are available to users in other groups, unless those files have been protected in some special way (by a lockword, for instance). All of the files in your home group are available to you (the user). Notice, though, that you cannot push a file to the PUB group (keep a file into the PUB group while working in MYGROUP) unless you have account manager capability, or unless you have security access to that group. Standard security is maintained between other groups. Files cannot be read (looked at) or copied from a non-PUB, non-home group, unless those files are released, or unless you have account manager capability, or unless you have access to that group. Similarly, you cannot push a file into another group unless you have account manager capability, or unless you have security access to that group. The concept of account security becomes a little clearer in the context of copying and deleting files. What works depends on a number of factors. Assume that:
Tables 5-2, 5-3, and 5-4 illustrate what you can do, depending upon which group that you are currently working in. Table 6-2 You Are in PUB
Table 6-3 You Are in MYGROUP (Your Home Group)
Table 6-4 You Are in OTHERGRP (Not PUB, Not Home)
Any file that you release loses almost all protection from other users, unless it has a lockword. Other users in other groups or accounts can do the following:
Once the file is copied, it should always have the system security restored to it. To do this, use the MPE/iX SECURE command. Get into OTHERGRP.
CHGROUP OTHERGRPReturn
Enter this to reinstate the security on TEST:
SECURE TESTReturn
This action ensures that no unauthorized access of your file can occur. You can use LISTFILE to discover the kind of security that is in effect for a file. Do this:
LISTFILE TEST,3Return
Do you get a screenful of information? Much of the information in this display is intended for advanced users. Look in the right column, where it says SECURITY IS ON. This tells you that TEST has not been released. Now release TEST:
RELEASE TESTReturn
Check to see the security status of TEST.
LISTFILE TEST,3Return
Now, reinstate the security for the file TEST. Enter:
SECURE TESTReturn
You may have given little thought to the possibility of running out of disk storage on the computer. It is unlikely. But it can happen, especially if you keep copies of various versions of large files. The system manager can set limits on the amount of disk space that those files can occupy. If you run out of space, you get an error message on the screen. OUT OF DISC SPACE (FSERR 46) There are two things you can do:
|