COPY



COPY

     Copies one file to another by creating a new file or by
overwriting an existing file. The copy command can be used
to copy files to and from HFS directories. Also users with
SM capabilities are able to copy files to MPE accounts
outside of their current logon account, or to restricted
directories.

SYNTAX

     COPY [FROM=]sourcefile[[;TO=]targetfile]
{ASK}
[;{YES}]
{NO }

NOTE

This command follows the more flexible MPE/iX command line syntax.

PARAMETERS

sourcefile          The name of the file that is to be copied.  A
file with HFS syntax must begin with a dot (".")
or a slash ("/").

targetfile The name of the file to which sourcefile is to be
copied. If targetfile is omitted, the sourcefile is
copied to sourcefile in the user's current working
directory (CWD). targetfile may be specified as
a qualified or unqualified MPE or HFS name, as only
a group[.account] name, or as only a directory name.

If only the group is specified COPY puts a copy of
the source file in a file named "sourcefile.group",
or as "/ACCOUNT/GROUP/sourcefile" if the source file
is an HFS name.

If only a directory name is specified COPY copies
the source file to "./directory/sourcefile".
Note: MPE named source file names are upshifted as
target names.

A target group name is specified as ".group[.account
A target directory name is specified as "dirname" or
"./dirname", depending on the syntax of the
directory name. Optionally, a target directory name
can end in a slash (/) as a way to improve the
readability of COPY command in JCL and scripts. When
the target name ends in a slash it is assumed to be
a directory.

Since a target groupname is introduced with a
leading dot (.) and HFS filenames can also start
with a dot, (.), this could lead to confusion as to
whether an MPE group or HFS filename is desired for
the targetfile. f the targetfile is an HFS filename
starting with a dot, then the targetfile must be
preceded with a dot, slash and dot. For example,
to represent a targetfile ".foo" in the CWD, the
name must be specified as "./.foo".

ASK If targetfile already exists, copy will prompt the
user to choose an action with the following prompt

"Purge old TARGETFILE.GROUP.ACCOUNT?"

Valid replies to this prompt are

Y or YES instructs COPY to purge the original
targetfile, thus creating a new
targetfile.

N or NO instructs copy to terminate.

ASK is the default, except in a job or in other
cases where $STDIN and $STDLIST are not an
interactive pair. In such cases, ASK has no meaning
and YES becomes the default.

YES instructs copy to purge targetfile if it already
exists. No message is displayed for the user, as
would be the case with ASK. YES is the default in
jobs, or at other times when $STDIN and $STDLIST are
not an interactive pair.

NO instructs COPY to terminate if targetfile already exists.

OPERATION

     This command performs a fast copy of sourcefile to targetfile and
leaves sourcefile unchanged. Both files must be disk files residing
on the host system. The user must have appropriate file system
access to both the source file and the directory or group where the
new target file will reside.

You may specify files that are backreferenced with a file equation
(*). However, this command supports only three file equation
options: file name, final disposition (;SAVE or ;TEMP) and the
disc volume or volume class (;DEV=disc or ;DEV=).
All other file equation options are ignored. Also, the right-hand
(actual designator) name cannot refer to a directory.

The file disposition of the targetfile defaults to that of the
sourcefile. For example, if the sourcefile is TEMP, the targetfile
will be created TEMP. If the sourcefile is PERM, the targetfile
will be created as PERM. You may override this default disposition
by using a file equation.

All file access attributes of the sourcefile, including ACD's
(Access Control Definitions) will be duplicated for the
targetfile. If a source file has an ACD, the ACD will be copied
to the target file. If a file does not have an ACD, when it is
copied outside an MPE group, it will be automatically assigned
an ACD.

You may not specify system-defined files ($ prefix) or CM KSAM
files as sourcefile or targetfile.

Note: the target file MAX EXTENT value may not be the same as for
the source file.

The COPY command may be invoked from a session, job, or
program or in break. Pressing [BREAK] aborts the execution
of this command. If the target file existed prior to the copy
and COPY was permitted to delete it, the target file is not
reinstated after BREAK aborts the copy operation.

The COPY command is CWD relative. If a filename is not fully
qualified, the current working directory information is appended
to the file and used as path information. If there is a
programmatic chdir(), the COPY command executes based on the
new CWD.

EXAMPLE(S)

         The command below copies ./CWD/ABCD to ./CWD/EFG.  Note
that unless you have changed your current working directory,
your CWD is your logon group. When your CWD is the same as
your logon group, the command below copies ABCD.logongroup
to EFG.logongroup.

COPY abcd, efg

The commands below copy ./CWD/ABCD to ABCD.newgroup. When your
CWD is the same as your logon group the command below copies
ABCD.logongroup to ABCD.newgroup.

COPY abcd, abcd.newgroup

or

COPY abcd .newgroup


The next example copies ABCD.GRP to ./CWD/ABCD. Note if your
CWD is the same as your logon group then the command below
copies ABC.GRP to ABC.logongroup.

COPY abcd.grp


The commands below copy a file with a lockword on it,
separated from the file name with a slash (/).

COPY abcd/lockword tofile

or

COPY abcd/lockword.grp,efg


In the next example the file "myfile.pub.sys" is copied to
an HFS file named "MyFile". Note that the target file name has
to have the "./" prefix.

COPY myfile.pub.sys, ./MyFile


In the next example, the file "Posix" under the CWD is copied
to "MYFILE.PUB" in the current account.

COPY ./Posix, myfile.pub


The next examples copy the MPE-named file CALI to the MPE-named
directory DIR in the CWD, resulting in ./CWD/DIR/CALI. Note,
in the last case, a trailing slash (/) is allowed but not
required. Using a trailing slash after a directory may improve
readability of job streams and scripts.

COPY cali dir

or

COPY cali ./DIR

or

COPY ./CALI ./DIR/


The example below copies the HFS-named file "summer" to the HFS
named directory "a_dir" in the CWD, resulting in
./CWD/a_dir/summer.

COPY ./summer , ./a_dir


The last example copies a file named "Sierra" to the directory
named "/bin"

COPY ./Sierra /bin

RELATED INFORMATION

COMMANDS:    FCOPY, CHDIR

MANUALS :    Using The 900 Series HP 3000: Fundamental Skills
             (32650-60037)