Lesson 1 Using FCOPY [ Using the 900 Series HP 3000: Advanced Skills Module 4: File Transfer and Storag ] MPE/iX 5.0 Documentation
Using the 900 Series HP 3000: Advanced Skills Module 4: File Transfer and Storag
Lesson 1 Using FCOPY
Introduction
Lesson 1 presents the following information on FCOPY:
* Comparison to COPY command.
* Copying files within and across accounts.
* Appending files.
* Copying files to and from other devices.
Figure 4-1. FCOPY
You have probably used the COPY command for copying files within an
account. In this lesson you'll be learning about the FCOPY utility,
which can perform additional copying functions within an account and give
you more
flexibility in copying files to other locations. This utility can be
treated as a command by entering all of its parameters in one command
line. This is the way you will be treating it throughout this module.
Be sure that you are logged into the CLASS group of your account.
FCOPY and COPY commands
FCOPY is used to copy single files from one location to another.
Usually, this means copying files from one disk location to another;
however, FCOPY can also be used to copy files from or to devices other
than disk. However, for now concentrate on copying files within your
account.
When using FCOPY as a command, rather than as a utility, the syntax for
the FCOPY command is similar to that of the COPY command:
COPY: COPY FROM=filename;TO=filename
FCOPY: FCOPY FROM=filename;TO=filename
Notice the locations of the equal signs (=) following the words FROM and
TO. Many users make mistakes here.
The FROM information tells your system the name of the source file
and its location. The TO information tells the system the name of the
new or destination file and its location.
Adding the NEW option at the end of the FCOPY command assures you that
the command will not copy the file over a previously existing file with
the same name.
FCOPY FROM=filename;TO=filename;NEW
Adding the NO option at the end of the COPY command ensures the same
thing as the FCOPY NEW option.
COPY FROM=filename;TO=filename;NO
Also note that semicolons are entered at the end of both the FROM and the
TO information to separate the two parameters from each other.
FCOPY and COPY also differ in the way they copy files. The COPY command
purges the file, then creates a new file with the characteristics of the
source file. FCOPY copies into the file and tailors the source to
destination file characteristics. This is why you cannot use the COPY
command to alter the record size of a file. However, FCOPY allows this
by truncating the records and fitting them into the destination file.
Copying files within an account
Like the COPY command, the FCOPY command can be used to copy files within
an account and between accounts.
Suppose you want to duplicate the MYJOB1 file currently in the CLASS
group and call the duplicate copy MYJOB1A. The command syntax looks like
this:
FCOPY FROM=MYJOB1;TO=MYJOB1A;NEW
Enter that command now on your terminal.
Unlike COPY, which displays another prompt following a successful copy,
FCOPY provides detailed information regarding the copy process at its
successful conclusion.
Did you get the following information on your display noting that the
copy was completed successfully? (If not read the following section.)
________________________________________________________________________
| |
| |
| HP32212A.03.24 FILE COPIER (C) HEWLETT-PACKARD CO. |
| 1984 |
| |
| |
| |
| EOF FOUND IN FROMFILE AFTER RECORD 9 |
| |
| 10 RECORDS PROCESSED *** 0 ERRORS |
| |
| END OF SUBSYSTEM |
| |
________________________________________________________________________
If you get an error message
If you got a syntax error, check your FCOPY command again to be sure that
you have entered the command correctly.
________________________________________________________________________
| |
| |
| *54* SYNTAX ERROR |
| |
________________________________________________________________________
If the syntax error message appeared, check the equal sign (=) after the
FROM and TO, and the semicolon (;) before the TO.
________________________________________________________________________
| |
| |
| *144* NEW OPTION: FILE ALREADY EXISTS |
| |
________________________________________________________________________
If this NEW option error message appears change the new name for your
file to MYJOB3 in your FCOPY command.
Copying files between groups
As an account manager you can copy files across groups in your account
even though you are not the creator of the file or are not in the
destination group.
For example, as the account manager you may want to keep a copy of a file
(PFILE) in each of your account groups. The master copy of this file
would remain in the PUB group.
Go ahead and copy this file (PFILE) from the PUB group to each of the
groups in your account.
FCOPY FROM=PFILE.PUB;TO=PFILE.groupname;NEW
NOTE Insert the name of the group (PROJECT or CLASS) for "groupname"
when you want to copy the file to that group.
--------------------------------------------------------------------------------------------
| |
| Q4-1 How is the the syntax of the FCOPY command that is used to copy files |
| between groups different from the syntax of the FCOPY command that is used |
| to copy files within a group? |
| |
| |
--------------------------------------------------------------------------------------------
Copying files between accounts
There are times when you will need to copy files between different
accounts. The FCOPY command will let you do this with the following
provisions.
* The file must be released at its source location.
* The file must be copied from the destination location.
* The source file name must be fully qualified.
Teaching exercise 4-1:copying files across accounts.
This exercise will walk you through the procedure to copy a file from one
account to another.
NOTE If you are taking this course by yourself, ask someone who has an
account on the system you are using to release a nonessential file
for you to use for this practice exercise. Substitute the name of
that file in the procedure.
Step Ask another student to release a copy of the MYJOB1 file from
1. their CLASS group. Find out their account name.
RELEASE MYJOB1
Step If you are not already logged on to your own account, log on now.
2.
Step Enter the following FCOPY command on your keyboard substituting
3. the other student's account name for ACCTx.
FCOPY FROM=MYJOB1.PUB.ACCTx;TO=MYJOB1.PROJECT;NEW
Step Errors? Check your syntax and reenter. Check the next section,
4. "Problems," if needed.
Step Use the LISTFILE command to make sure the file transfer was
5. completed successfully.
LISTFILE MYJOB1.PROJECT
Step Ask the other student to secure the file.
6.
SECURE MYJOB1
Go through the same procedure again for more practice. Copy the same
file to your account; however, this time rename the file MYJOBX.
1. What command must be entered before a file can be copied to
another account?
2. What FCOPY command should you enter to copy the file to your
account and rename the file MYJOBX?
3. What command should you enter to make sure the file transfer was
completed successfully?
4. What command should the owner of the file enter to secure the file
following the copy process?
********** End of Exercise 4-1 **********
--------------------------------------------------------------------------------------------
| |
| Q4-2 What additional information regarding the file to be copied is required when |
| copying a file from a different account rather than from a different group? |
| |
| |
--------------------------------------------------------------------------------------------
Problems?
Check this section of the lesson if you had problems; otherwise,
congratulations on your file transfer!
The most frequent error message is
________________________________________________________________________
| |
| |
| CAN'T OPEN FROM FILE |
| |
________________________________________________________________________
To correct this, ask your partner who has the source file to again
release the MYJOB1 file before repeating steps 3 through 6.
If you get a syntax error, examine your file command line again to make
sure that it is written correctly.
Exercise 4-2:appending one file to another
There will be times when you want to append several files together.
FCOPY can do this by creating a new file and then appending additional
files to this file. In this exercise you will combine JOB1, JOB2, JOB3,
and JOB0 in a single JOBX file.
1. Determine the total number of records used by each file using
LISTFILE, 1. Add these together.
LISTFILE JOB?, 1
The question mark tells LISTFILE to display all files that have
JOB as the first three letters of the name and any fourth letter
or number. The ? is a wildcard character.
2. Enter a FILE command to set up the new file JOBX. Give this file
Append access.
Enter the total number of records, plus 10 (to be on the safe
side) as DISC=number-of-records.
FILE F1=JOBX;REC=-88,,F,ASCII;ACC=APPEND;DISC=72
3. Copy JOB1 to the JOBX file. Backreference the file designator and
use the NEW option in the FCOPY command. (You will get a warning
indicating that the FROMFILE has records that are 80 bytes long,
while the TOFILE has records that are 88 bytes long. You will
then be asked if you wish to continue. Answer Y for Yes).
FCOPY FROM=JOB1;TO=*F1;NEW
You will get a warning indicating that the FROMFILE has records
that are 80 bytes long, while the TOFILE has records that are 88
bytes long. You will then be asked if you wish to continue.
Answer Y for Yes.
4. Use the LISTFILE,2 command to check on the existence of the new
JOBX file. How many records does it have?
LISTFILE JOBX,2
5. Append JOB2 to the JOBX file. Again backreference the file
designator. Do not use the NEW option in the FCOPY command.
FCOPY FROM=JOB2;TO=*F1
6. Use the LISTFILE,2 command to show the increased size of the JOBX
file. How many records does it have?
How much larger is the JOBX file now?
7. Append JOB3 to the JOBX file. What FCOPY command would you use to
do this?
8. Again, check the size of the JOBX file.
How large is the JOBX file now?
9. Append the JOB0 file to the JOBX file.
What FCOPY command would you use to do this?
10. Use the LISTFILE command to check on the size of the JOBX file.
********** End of Exercise 4-2 **********
Copying files from disk to other devices
To use the FCOPY command to copy files from disk to other devices (such
as tape or peripherals), you must do the following:
* Use a FILE command to define a file name for your device. For
example, assign the name LIST to the line printer (LP).
FILE LIST;DEV=LP
* Use the device's filename as the TO filename. Precede the file
name with an asterisk to backreference it.
FCOPY FROM=MYJOB1.CLASS.ACCTx;TO=*LIST
--------------------------------------------------------------------------------------------
| |
| Q4-3 Suppose you have assigned the name OUT to the line printer. How would you |
| write the file equation to define the device? What FCOPY command would copy |
| the MYJOB2 file to this device? |
| |
| |
--------------------------------------------------------------------------------------------
Copying files to and from devices other than disk
What if you want to copy files from a tape to a line printer? The FCOPY
command can do this kind of copying as well. No file release is
required. However, you must do the following:
* Define your device files.
FILE TAPEFILE;DEV=TAPE;REC=-80,,F,ASCII
FILE PRINTER;DEV=LP
* Use the two formal file designators as the FROM file and TO file
in an FCOPY command. Backreference the filenames with asterisks.
FCOPY FROM=*TAPEFILE;TO=*PRINTER
NOTE TAPEFILE and PRINTER are the formal file designators in the FCOPY
command. TAPE and LP are device class names for a magnetic tape
unit and a line printer, respectively. In this case you must
define the size of the records on the tape.
--------------------------------------------------------------------------------------------
| |
| Q4-4 Assuming that the file information and file name designators are correct, |
| will the following file equations and FCOPY command copy MYJOB1 to tape? |
| |
| |
| |
| FILE T;DEV=TAPE;REC=-80,,F,ASCII |
| |
| FCOPY FROM=MYJOB1.CLASS.ACCTx;TO=T |
| |
--------------------------------------------------------------------------------------------
Lesson summary
1. The FCOPY and COPY commands are very similar in syntax; however,
FCOPY uses the NEW option to prevent overwriting a file; COPY uses
a NO option.
COPY FROM=MYFILE;TO=MYFILE.PUB;NO
FCOPY FROM=MYFILE;TO=MYFILE.PUB;NEW
2. Both FCOPY and COPY allow you to copy a file from another account
to your current account. You issue the respective command from
the destination account and fully qualify the source file name.
FCOPY FROM=MYFILE.PUB.ACCTx;TO=MYFILE;NEW
3. When using FCOPY to copy files to and from other devices, first
define your device files and then backreference the file
designators in your FCOPY command.
FILE PRINTER;DEV=LP
FCOPY FROM=MYFILE;TO=*PRINTER
4. To append files, first create a formal file with the FILE command
and the APPEND option. Backreference the file designator in each
FCOPY command to append each successive file.
FILE F=FILE1;REC=-80...,;ACC=APPEND:DISC=number-of-records
FCOPY FROM=FILE1;TO=*F;NEW
FCOPY FROM=FILE2;TO=*F
Exercise 4-3:lesson 1 review
1. Note which tasks you are required to do when copying files:
--------------------------------------------------------------------------------------------------------
| | | | | |
| Tasks | Within | Within | Account to | Device to |
| | Group | Account | Account | Device |
| | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| a. | Release file before copying. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| b. | Define the device file(s). | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| c. | Fully qualify the file names | | | | |
| | (file.group.account). | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| d. | Backreference device file names | | | | |
| | with asterisks. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| e. | Require only the FROM filename | | | | |
| | and the TO filename. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| f. | Be in the destination account | | | | |
| | when you issue the FCOPY | | | | |
| | command. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| g. | Secure the file after copying. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
| | | | | | |
| h. | Note the group names for the | | | | |
| | source and destination file | | | | |
| | locations. | | | | |
| | | | | | |
--------------------------------------------------------------------------------------------------------
2. What FCOPY command would you use to copy the DEPTCEN file from the
PUB group in the FINANCE account to the PROJECT group in your
account?
3. Suppose you would like to copy MYFILE1 currently in your CLASS
group to tape. Write the file equation to define the device
(tape) and the FCOPY command to copy the file.
4. Correctly sequence the steps to copy a file from one account to
another. (Assume you are logged on to the source account.)
a. Log on to the source account and secure the original file.
b. Release the file.
c. Enter the FCOPY command.
d. Log on to the destination account.
e. Use LISTFILE to check the file transfer.
********** End of Exercise 4-3 **********
MPE/iX 5.0 Documentation