Copying Files from Tape or CD-ROM

No single file on a tape or CD-ROM can be copied more than once from the same tape or CD-ROM in the same<copy from group>.

Examples

The following COPY statement causes the library maintenance to issue an “MT<unit number>X NOT ON T” error message for the second request unless there are two files named X on T:

COPY X, X AS Y FROM T

However, the following COPY statement copies X twice:

COPY X FROM T, X AS Y FROM T

For a COPY statement that includes a directory name and a file name that belongs under that directory name, library maintenance issues a “<unit> <file name> NOT ON <volume name>” error message, depending on whether the matching directory name or file name appears first in the COPY statement.

In the following example, the COPY statement causes library maintenance to issue an “MT<unit number> A/B NOT ON T” error message:

COPY A/=, A/B FROM T

However, the following statement ,might cause library maintenance to issue an “MT<unit number> A NOT ON T” error message, depending on whether there are files other than A/B under the A directory on tape T:

COPY A/B, A/= FROM T

When copying directories from tape or CD-ROM, if you specify two directories with the same name in the same FROM clause, library maintenance issues a “<unit> <directory name> NOT ON < volume name>” error message for the specified second directory.

For example, the following statement copies once only the files under X:

COPY X/=, X/= FROM T

However, the following statement copies the files under X twice:

COPY X/= FROM T, X/= FROM T

When copying directories from tape or CD-ROM, if you specify two directories in the same FROM clause and one directory subsumes the other, then library maintenance issues a “<unit> <directory name> NOT ON < volume name>” error message, depending on which directory appears first in the list.

For example, the following statement causes library maintenance to issue the error message “CD <unit number> X/Y NOT ON C”:

COPY X/=, X/Y/= FROM C(CD)

However, the following statement might cause library maintenance to issue an “CD <unit number> X NOT ON C” error message, depending on whether there are any files on the tape under the X directory that are not under the X/Y directory:

COPY X/Y/=, X/= FROM C(CD)

Copying Files with or without Usercodes

Library maintenance selects usercoded and unusercode files differently when you copy files from tape, depending on whether the task is running with a usercode.

Running without a Usercode

The following list shows how library maintenance determines how to select files when the task is unusercoded. Files without usercodes are indicated by an asterisk (*).

  • COPY = FROM TAPE  
    COPY = FROM C(CD)

    Conditions: Task running without a usercode.

    Result: Selects all files on source volume.

  • COPY *= FROM TAPE 
    COPY *=FROM C(CD) 

    Conditions :Task running without a usercode.

    Result: Selects all files on source volume.

  • COPY D/=FROM TAPE 
    COPY D/=FROM C(CD)

    Conditions: Task running without a usercode and copying files from a directory without specifying a usercode.

    Result: Selects all files that match the specified directory.

  • COPY *D/=FROM TAPE  
    COPY *D/= FROM C(CD)

    Conditions: Task running without a usercode and copying files from a directory with an asterisk (*).

    Result: Selects all files from the directory under the asterisk (*) directory.

Running under a Privileged Usercode

The following list shows how library maintenance determines how to select files when the task is running under a privileged usercode. Files without usercodes are indicated by an asterisk (*).

  • COPY * = FROM TAPE 
    COPY * = FROM C(CD)

    Conditions: Privileged task running with a usercode and copying files from an asterisk (*) directory.

    Result: Selects all files on source volume.

  • COPY = FROM TAPE
    COPY = FROM C(CD)

    Conditions: Privileged task running with a specific usercode and copying files without indicating a usercode.

    Result: Selects files either from the asterisk (*) directory or from the task usercode, but not from both. The first file the system finds on the source volume that matches either the asterisk (*) directory or the usercode determines the location from which files are copied.

    Example: If the first matching file is an asterisk (*) directory file, only matching asterisk (*) directory files are copied. If the first matching file is a file under the task usercode, the system copies only files that match that usercode.

  • COPY D/= FROM TAPE
    COPY D/= FROM C(CD)

    Conditions: Privileged task running with a usercode and copying files from a directory without an asterisk (*) directory or specific usercode.

    Result: Selects files either from the asterisk (*) directory or from the task usercode, but not from both. The first file the system finds on the source volume that matches either the asterisk (*) directory or the usercode determines the location from which files are copied.

    Example: If the first matching file is an asterisk (*) directory file, the system copies only matching asterisk (*) directory files. If the first matching file is a file under the task usercode, the system copies only files that match that usercode.

Running Under a Nonprivileged Usercode

The following list shows how library maintenance determines how to select files when the task is running under a nonprivileged usercode. Files without usercodes are indicated by an asterisk (*).

  • COPY *=FROM TAPE
    COPY *=FROM C(CD)

    Conditions: Nonprivileged task running with a specific usercode and copying files from an asterisk (*) directory.

    Result: Does not select any files for copying.

  • COPY D/= FROM TAPE
    COPY D/= FROM C(CD)

    Conditions: Nonprivileged task running with a specific usercode and copying files from a directory that does not indicate an asterisk (*) directory or specific usercode.

    Result: Selects only those files under the task usercode that match the directory specification.

  • COPY = AS ... FROM TAPE
    COPY = AS ... FROM C(CD)
    COPY = ONTO...FROM TAPE
    COPY = ONTO...FROM C(CD)
    COPY D/= AS...FROM TAPE
    COPY D/= AS...FROM C(CD)
    COPY D/= ONTO...FROM TAPE
    COPY D/= ONTO...FROM C(CD)
    

    Conditions: Using the AS or ONTO option with a nonprivileged task running with a specific usercode and copying files from a directory that does not indicate an asterisk (*) or specific usercode.

    Result: Selects files either from the asterisk (*) directory or from the task usercode, but not from both. The first file the system finds that matches either the asterisk (*) directory or the usercode determines which files are copied.

    Example: If the first matching file is an asterisk (*) directory file, the system copies only matching asterisk (*) directory files. If the first matching file is a file under the task usercode, the system copies only files that match that usercode.

Copying Files to CD-ROMs

COPY to KIND=CD writes an image of a library maintenance format CD-ROM to a temporary disk file. The image is then transferred to a blank CD-R disc that is mounted on a CD-R drive connected directly to a SCSI channel adapter.

Note: CD-R drives function as CD-ROM drives when reading CD-ROMs; however, CD-R drives can also write to blank write-once CD-R media, creating a CD-ROM.

When you write to a library maintenance CD-ROM, you can specify the SERIALNO attribute for the destination volume. The specified serial number is assigned to the CD‑ROM as it is written. However, you can specify only a single serial number. If you create a multiple-volume set of CD-ROMs, all are assigned the same serial number.

When you read a library maintenance CD-ROM, if you do not specify the SERIALNO attribute for the source volume, a source CD-ROM is used whether has a serial number or not. However, if you do specify the SERIALNO attribute for the source volume, a source CD-ROM is used only if it has a matching serial number.

Track-at-once is the default recording mode. If you specify the attribute PACKETWRITE, “packet write” recording is used when the CD-ROM is written. Additionally, you can specify how many copies of the disc are to be burned with the attribute CDCOPIES. Refer to the explanations for each of these settings in the following paragraphs.

Before the CD-ROM disc is finalized with the CLOSE SESSION SCSI command, the entire data track is read and compared with the image file to ensure that no media defects affected the burn.

Note: Except during this compare operation, the MCP refuses to read a CD-ROM disc that is not finalized. Discs that fail the compare operation cannot be read by mistake thereafter.

The family used for the temporary disk file must have room for the entire image. Also, for track-at-once recording, you cannot use a family that is heavily used by other programs. The temporary disk file is created on the default family of the task executing the COPY statement, unless you set the TASKSTRING attribute of that task to

FAMILYNAME = <family name>

Restrictions

  • The capabilities of KIND=CD apply only to the COPY statement and are not valid with the ADD statement.

  • The only “& options” are COMPARE, DSONERROR, WAITONERROR, and REPORT.

  • There can be only one destination volume and the destination volume cannot require quotes.

  • The source and destination volumes must both be on the local host. NFT is not supported.

  • Except when using the MULTIVOLUME file attribute, the data must fit on a single CD-ROM.

  • For track-at-once output, a single CD-ROM holds 681984000 bytes or 333000 CD-ROM sectors of 2048 bytes each.

  • For packet write output, a single CD-ROM holds 657553408 bytes or 321071 CD‑ROM sectors of 2048 bytes each.

  • All errors except skipped files are fatal and cause the task executing the COPY statement to terminate with a failure.

  • The HOSTNAME attribute cannot be specified when KIND = CD.

Example 1

COPY TEST1, TEST2 TO GGG(CD);

A library maintenance CD-ROM named GGG is created. The disk contains files TEST1 and TEST2.

Example 2

BEGIN JOB J;
     TASK T;
     T(TASKSTRING= "FAMILYNAME = BLUE");
     COPY *SYSTEM/PRINT/= TO SYSTEM_PRINT(CD) [T];
END JOB

A library maintenance CD-ROM named SYSTEM_PRINT is created. The disc contains all the files from *SYSTEM/PRINT/=.

The temporary disk file used to hold the CD-ROM image is placed on family BLUE.

Example 3

COPY (USER9)= FROM GREEN(PACK),
      =FROM TEST4 (SERIALNO= "123321"),
     *SYSTEM/PRINT/= FROM SYSTEM_45123(CD) TO
     SYSTEM_012(CD);

A library maintenance CD-ROM named SYSTEM_012 is created. The disc contains all the files from (USER9)= on family GREEN, from tape TEST4 (with serial number 123321), and from *SYSTEM/PRINT/= on CD SYSTEM_45123.

COPY = AS and COPY *= AS

The COPY = AS . . . and COPY *= AS . . . statements initiate one of the following actions:

  • Select all files to be copied from the source volume.

  • Select all files under the usercode of the task, and copy the files from the input volume.

  • Select all files under the global *directory, but will not select any files under usercodes to be copied from the input volume.

  • Select no files for copying.

    When either statement is used to select input files with usercodes in their file names, the output file name is formatted in one of the following ways:

  • The output file names contain the same usercode as the input file names.

  • The output file name does not contain the usercode. The output files are copied to the global *directory.

  • The usercode of the output file name is changed to an ordinary node name.

    The outcome of specifying a simple directory such as = or *= for the input files, followed by AS and an output directory specification, varies depending on whether

  • You specify COPY = AS . . . or COPY *= AS . . . .

  • The task is run with or without a usercode, and the task is a privileged or a nonprivileged task.

  • The source is a disk or a tape.

The following table is a description of using the COPY statements COPY = AS . . . and COPY *= AS . . . to copy files running without a usercode, with a usercode, or with a privileged usercode.

COPY Statement

Conditions

Result

COPY = AS...

COPY *= AS...

Task running without a usercode with a disk or tape input volume

Selects all files on the input disk or tape volume and changes the usercode node of any input file to an ordinary node in the output file name.

COPY = AS...

Task running under a privileged or a nonprivileged usercode with a disk input

Selects only the files under the usercode of the task.

COPY = AS...

Task running under a privileged or a nonprivileged usercode with a tape input volume

Selects files under the usercode of the task or files without usercodes . The file order on the tape determines which files are copied. If a file with the usercode of the task is found on the tape before a file without a usercode, only files under the usercode of the task are copied. If a file without a usercode is found on the tape before a file with the usercode, of the task, only files without usercodes are copied. All output file names correspond to the name specified after the word AS in the COPY statement.

COPY *= AS...

Task running under a privileged usercode

Selects all files on the input volume for copying and changes the usercode node of any input file name to an ordinary node in the output file name.

Note: A task running with a nonprivileged usercode is not permitted to use this construct and will receive a run time security error.

Examples

Tasks running without a usercode:

  • This example copies the input file *X as *ABC/X and copies the input file (UC)Y as *ABC/UC/Y:

    COPY = AS ABC/=
  • These examples copy the input file *X as *X and copies the input file (UC) Y as *UC/Y:

    COPY = AS =
    COPY *= AS =
    COPY *= AS *=

    Tasks running under a privileged or a nonprivileged usercode with a disk input volume:

  • This example copies all the files under the usercode of the task UC without changing their names. This statement is equivalent to the following statement:

    USER=UC
    COPY = AS = FROM DISK...
  • This example copies the input file (UC)X as (UC)X. Files such as *Y or (XUSER)FILE are not copied.

    COPY = FROM DISK...
  • This example copies the input file (UC)X as *X.

    USER=UC
    COPY = AS *= FROM DISK...

    (Files such as *Y or (XUSER)FILE are not copied.)

    Tasks running under a privileged or a nonprivileged usercode with a tape input volume:

  • This example copies the file (UC)X as (UC)P/X.

    USER=UC
    COPY = AS P/= FROM TAPE...
  • This example copies the file (UC)X as *Q/X.

    USER=UC
    COPY = AS *Q/= FROM TAPE...
    Note: If this statement is used to copy to a disk, a nonprivileged user gets a security error and no files are copied.

    Tasks running under a privileged usercode:

  • This example copies the input file *X as *ABC/X and copies (UC)Y as *ABC/UC/Y.

    USER=PRIV
    COPY *= AS *ABC/=
  • This example copies the input file *X as *X and copies (UC)Y as *UC/Y.

    USER=PRIV
    COPY *= AS *=
  • This example copies the input file *X as (PRIV)X and copies (UC)Y as (PRIV)UC/Y.

    USER=PRIV
    COPY *= AS =