HPlogo Using HP 3000 MPE/iX: Fundamental Skills Tutorial: HP 3000 MPE/iX Computer Systems > Chapter 6 Working with Files

Lesson 6 Copying Files

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Lesson 6 presents the commands needed to copy files.

  • the command to copy a file: COPY

  • the command to remove system security for a file: RELEASE

  • the command to restore system security for a file: SECURE

  • conserving disk space

Using the COPY command

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:

  • The FROM= parameter tells the computer which file to copy from. The original, from which the copy is made, is called the source file.

  • The TO= parameter tells the computer what to call the copy. The to file is called the target or destination file.

Use LISTFILE to verify that a new file called ANEWDOC appears. Use PRINT to look at the file:


   PRINT ANEWDOCReturn

A simpler COPY

The COPY command permits you to shorten the command line a little. You can leave out ;FROM= and ;TO=.

Do this:


   COPY DOCUMENT,OLDDOCReturn

NOTE: In place of the semicolon ( ; ) is a comma ( , ) to separate the source file from the destination file.

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.

NOTE: A few commands such as COPY permit you to use a somewhat simpler command line. Those MPE/iX commands with an alternative, simpler syntax are noted in the help facility.

Copy to an existing file

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.

Copy over an existing file

In order to copy ANEWDOC into the existing file DOCUMENT, the computer must do this:

  • First destroy the contents of DOCUMENT.

  • Then copy the contents of ANEWDOC into the newly emptied destination file.

This process is called overwriting. Before doing that, the computer needs instructions from you.

What to do:

  • If you want to continue the COPY process (permit the overwriting — and destruction — of the destination file), enter YES or Y at the prompt question.

  • If you want to stop the COPY process (prohibit the overwriting), enter NO or N at the prompt question.

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
   :

More practice with COPY

Make sure that you are in your home group.

Enter:


   CHGROUPReturn

NOTE: Recall that files can be locked. A file that has been locked with a lockword cannot be copied by anyone who does not know how to unlock the file. The topic of locked files is covered in the tutorial 900 Series HP3000: Advanced Skills.

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:

  • Copy one file in the group that you are in and give the copy a new name.

  • Copy one file in the group that you are in and try to give it the name of another file that already exists.

  • Copy one file from the PUB group to the group that you are now in.

  • Copy one file from the OTHERGRP into the group that you are in.

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.

Releasing file security with the RELEASE command

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

NOTE: In order for a user to release a file, the user must be the creator of the file, or the following error message appears:

   ACTION DISALLOWED SINCE NOT CREATOR OF FILE (CIERR 351)

Copying from another group

To copy a file from another group to the group that you are in:

  • You must know the qualified name of the file that you want to copy.

  • You must be the account manager of the account in which both groups reside.

or

  • The owner of the file that you want to copy must release that file for you with the RELEASE command.

or

  • Group security must be organized to allow you access to the group.

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.

Default names in copying

MPE/iX makes assumptions when you copy files.

Default group name

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.

Default file name

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.

Copy and change file name

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.

  • You can pull a copy of a file from another group if the security has been released.

  • You cannot push a copy of a file from one group to another group unless you have account manager capability, or unless you have security access to that group.

PUB is a special case of account security (Figure 5-1).

Figure 6-1 PUB and Your Home Group: Relaxed Security

[PUB and Your Home Group: Relaxed Security]

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.

Figure 6-2 Other Groups: Strict Security

[Other Groups: Strict Security]

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.

Group to group security: what works

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:

  • MYGROUP is your home group

  • you do not have AM capability

  • the file that you want to work with has not been released with the RELEASE command

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

FILE LOCATED IN READ FILE SAVE OR ERASE IN ORIGINAL LOCATION
PUBYes Yes
MYGROUP Yes Yes
OTHERGRP No No

 

Table 6-3 You Are in MYGROUP (Your Home Group)

FILE LOCATED IN READ FILE SAVE OR ERASE IN ORIGINAL LOCATION
PUB Yes No
MYGROUP Yes Yes
OTHERGRP No No

 

Table 6-4 You Are in OTHERGRP (Not PUB, Not Home)

FILE LOCATED IN READ FILE SAVE OR ERASE IN ORIGINAL LOCATION
PUB Yes No
MYGROUP Yes Yes
OTHERGRP Yes Yes
ANOTHER GROUP No No

 

Reinstating system security to a file

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:

  • read the file

  • copy the file

  • edit the file

  • erase the file

The SECURE command

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

Conserving disk space

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:

  • Ask your system manager to increase the amount of disk space that you are allowed.

  • Free disk space by having some of your files stored to tape and then erase those files from the disk by using PURGE.

Lesson 6 Exercises

    1. Using the file ACORN, which was created in an earlier exercise, make a copy of the file and call it PINE. Make editing changes to the file PINE so that it now looks different. Save the file again as PINE.

    2. Try to copy the file PINE to the file ACORN. Answer NO to the prompt and look at the file ACORN. What happened?

    3. Try copying the file again. Answer YES to the prompt and look at the file ACORN. What happened?

  1. Which MPE/iX command removes all of the security provisions of a file to allow the file to be copied by another user in another group and account?

  2. Which MPE/iX command restores all of the security provisions to a file?

  3. If a file has not been resecured with the SECURE command, any user can:

    1. purge the file

    2. copy the file

    3. read the file

    4. all of the above

    5. none of the above

  4. If you do not specify a target file group when using the COPY command, to what group does the file get copied?

  5. If you run out of disk space in your account, to whom should you go to request more disk space?