TAPECOPY Procedure: z/OS

Copies an entire tape volume (tape or cartridge), or files from one or several tape volumes, to one output tape volume.
z/OS specifics: All

Syntax

PROC TAPECOPY options ;
INVOL options ;
FILES file-numbers ;

Details

Overview of PROC TAPECOPY

PROC TAPECOPY always begins writing at the beginning of the output tape volume; any files that previously existed on the output tape are destroyed.
Note: PROC TAPECOPY copies to a single output tape volume.
The TAPECOPY procedure can copy either standard labeled or nonlabeled tapes or cartridges. You can specify, within limits, whether the output tape is standard labeled (SL) or nonlabeled (NL). You cannot create an SL tape using an NL input tape because TAPECOPY cannot manufacture tape labels. Also, if LABEL=(,SL) was specified in a DD statement for an output tape volume, you cannot change that tape into a nonlabeled tape. PROC TAPECOPY does enable you to write over an existing volume label on a standard labeled tape if you specify LABEL=(,BLP) in the DD statement. (The BLP value indicates bypass label processing.)
The JCL DD statement parameter LABEL=(,BLP) must be authorized specifically by each computing installation. If your installation allows the BLP specification, then ANSI-labeled, nonstandard labeled, and standard user-labeled tapes can be treated as nonlabeled tape volumes. If the BLP specification is not authorized at your installation, then LABEL=(,BLP) is treated as LABEL=(,NL). PROC TAPECOPY works as you expect it to even if your tape is not labeled. Otherwise, the operating environment does not allow TAPECOPY to use the tape, thus preserving the label.
Throughout this description, references to specifying LABEL=(,BLP) assume that LABEL=(,BLP) is a valid specification at your installation.
CAUTION:
Record lengths cannot exceed 32K bytes.
PROC TAPECOPY copies up to 32K bytes of data per record, even if the length of the record exceeds 32K. No error message is generated.

Input Tape DD Statement Requirements

In the DD statement that describes an input tape, you need to specify the UNIT, VOL=SER, DISP parameters, and usually either the LABEL or DSN parameter.
VOL=SER gives the volume serial of the first input tape. You can omit VOL=SER if the UNIT parameter specifies deferred mounting--for example, UNIT=(tape,,DEFER). If you specify deferred mounting, remember to use the INVOL= option in the PROC TAPECOPY statement or in an INVOL statement to specify the volume serial of the input tape. For details, see the information about the INVOL= option or INVOL Statement .
For a nonlabeled input tape, you must specify either LABEL=(,NL) or LABEL=(,BLP) in the DD statement. If you are unsure whether the input tape volume is labeled or nonlabeled, specify LABEL=(,BLP) in the input tape DD statement, if your installation allows it.
For a standard labeled input tape at an installation that does not allow LABEL=(,BLP), specify LABEL=(,SL) and the DSN parameter, giving the DSNAME of the first data set on the tape.

Output Tape DD Statement Requirements

In the DD statement that describes the output tape, you usually need to specify only the UNIT, VOL=SER, and DISP parameters, and possibly the LABEL or DSN parameters.
VOL=SER gives the volume serial of the output tape. You can omit VOL=SER if the UNIT parameter specifies deferred mounting--for example, UNIT=(tape,,DEFER). If you specify deferred mounting, use the OUTVOL= option in the PROC TAPECOPY statement to specify the volume serial of the output tape. For details, see the information about the OUTVOL= option below.
You should usually specify DISP=(NEW,KEEP) for the output tape in the DD statement. At some installations, it might be necessary to specify DISP=(OLD,KEEP) along with the DSN parameter, giving the DSNAME of the first data set on the tape volume. The LABEL parameter should give the tape's label type as it is before the TAPECOPY procedure is executed, regardless of its label type after the copying operation.

Output

The TAPECOPY procedure writes to the SAS log a listing of the input and output tape characteristics plus a summary of the files that were copied.

PROC TAPECOPY Statement

PROC TAPECOPY options ;
The following options can appear in the PROC TAPECOPY statement:
COPYVOLSER
specifies that the output tape should have a standard label with the same volume serial as the first input tape. COPYVOLSER is effective only when both of the following conditions are true:
  • The output tape volume is to be standard labeled--that is, LABEL=SL.
  • The output tape DD statement specifies LABEL=(,NL) or LABEL=(,BLP).
Both of these conditions must be true because the PROC TAPECOPY statement LABEL= option specifies whether the output tape is standard labeled or nonlabeled after the copy operation. The output tape volume's DD statement LABEL= parameter specifies what the output tape's label status is before the copy operation.
If you specify COPYVOLSER and these conditions are not true, PROC TAPECOPY stops processing.
DEN=density
specifies the density of the output tape. (The DEN= option should not be specified for cartridge tapes.) If the DEN= option appears in the PROC TAPECOPY statement, it overrides any DCB=DEN specification in the DD statement for the output tape volume. If you do not specify a density in the PROC TAPECOPY statement or in the DD statement, the operating environment writes the tape at its default density. The default density is usually the highest density at which the unit allocated to the output tape volume can record.
The following table shows the valid density values:
Tape Density Value
Tape Volume Type
DEN=2
800 bpi
DEN=800
DEN=3
1600 bpi
DEN=1600
DEN=4
6250 bpi
DEN=6250
INDD=ddname
specifies the ddname that is referenced in the JCL DD statement for the first input tape volume. The default INDD= option value is VOLIN.
INVOL=volume-serial
specifies the volume serial of the first input tape when deferred mounting is specified in the DD statement for the first input tape. The INVOL= option specification overrides the volume serial, if any, that was specified in the DD statement for the tape.
Specify the INVOL= option only if you are using deferred mounting.
LABEL=SL | NL
specifies whether the output tape volume is to be standard labeled (LABEL=SL) or nonlabeled (LABEL=NL).
Note: Be careful not to confuse the LABEL= option in the PROC TAPECOPY statement with the DD statement parameter LABEL=(,specification). The PROC TAPECOPY statement LABEL= option specifies whether the output tape is standard labeled or nonlabeled after the copy operation. The output tape volume's DD statement LABEL= parameter specifies what the output tape's label status is before the copy operation.
The DD statement for nonlabeled output tapes must specify either LABEL=(,NL) or LABEL=(,BLP). If the output tape has an existing label (before the copy operation) and the output tape is to be nonlabeled (after the copy operation), then the DD statement must specify LABEL=(,BLP).
The default LABEL= option value is NL when multiple input volumes are used and when the DD statements for any of them specify LABEL=(,NL). If there are multiple input tapes and LABEL=(,NL) is not specified for any of them, and if the first input tape volume is actually standard labeled, then the default LABEL= option value is SL. This default value applies even if the DD statement specifies LABEL=(,BLP) for the first tape; in this case, PROC TAPECOPY reads the tape volume's first record to determine the actual label type.
NEWVOLSER=new-volume-serial
specifies a new volume serial for the output tape. NEWVOLSER is effective only if the output tape is standard labeled. If the output tape has an existing label, then the DD statement for the output tape must specify LABEL=(,BLP). Otherwise, PROC TAPECOPY stops processing and does not write over the label.
NOFSNRESEQ | NFR
specifies that file sequence numbers in the file labels should not be resequenced when a standard labeled output tape volume is being produced. PROC TAPECOPY usually resequences these numbers and updates the label in order to reflect both the ordinal position of the file on the output tape as it is copied and the actual density at which the output tape is written.
NOLIST
tells SAS not to write the tape characteristics and the summary of copied files to the SAS log. Even when you specify NOLIST, the SAS log contains a brief summary of PROC TAPECOPY's action; this summary is usually enough to verify proper functioning of PROC TAPECOPY if you are familiar with the contents of the input tapes.
NORER
tells SAS not to specify the "reduced error recovery for tape devices" feature of the operating environment for each input tape volume. When NORER is specified, some tapes of marginal quality can be read successfully by PROC TAPECOPY because the error recovery procedures are more extensive.
OUTDD=ddname
specifies the ddname that is referenced in the JCL DD statement for the output tape. The default OUTDD= option value is VOLOUT.
OUTVOL=volume-serial
specifies the volume serial of the output tape when deferred mounting is specified in the DD statement for the output tape. The OUTVOL= option specification overrides the volume serial, if any, that was specified in the DD statement for the tape.
Specify the OUTVOL= option only if you are using deferred mounting.

INVOL Statement

INVOL options ;
The INVOL statement defines an input tape volume from which some or all files are to be copied to the output tape volume. The INVOL statement is not necessary if you are using only one input tape nor for the first of several input tapes. (Use the INDD= and INVOL= options of the PROC TAPECOPY statement instead.) When you are using several input tapes, use an INVOL statement for each tape after the first input tape.
The following options can appear in the INVOL statement:
DSN | DSNAME='physical-filename'
specifies the data set name of the first file on the current input tape. You must use this option when both of the following conditions are true:
  • The data set name specified in the DD statement is incorrect or missing.
  • LABEL=(,SL) is specified (or implied by default) in the input tape volume DD statement.
You typically use this option when one of the following conditions is true:
  • The DD statement for the input tape specifies deferred mounting.
  • You are reusing a DD statement (and tape drive). That is, the fileref is the same but you want another standard labeled tape volume on the same unit. LABEL=(,SL) should be specified or implied by default, and the data set name cannot be the same as the data set name on the previous tape that was used with this fileref.
INDD=ddname
specifies the ddname that is referenced in the JCL DD statement for the current input tape. The default INDD= option value is the ddname that is already in effect for the previous input tape volume, as specified in the PROC TAPECOPY statement or in the last INVOL statement.
INVOL=volume-serial
specifies the volume serial of the current input tape. Use the INVOL= option when the JCL DD statement for the input tape specifies deferred mounting (as described in PROC TAPECOPY Statement), or when you are reusing a DD statement (and tape drive). That is, the ddname is the same, but you want a different tape volume on the same unit.
NL
specifies that the input tape is nonlabeled. If LABEL=(,SL) or LABEL=(,BLP) has been specified in the DD statement for the input tape and the tape is actually standard labeled, specifying the NL option causes the tape to be treated as if it were nonlabeled. In this case, any file numbers that are specified in FILES statements must be physical file numbers, not logical file numbers.
NORER
tells SAS not to specify the "reduced error recovery for tape devices" feature of the operating environment for the input tape volume. When this option is specified, some tapes of marginal quality can be read successfully by PROC TAPECOPY because the error recovery procedures are more extensive. If NORER is specified in the PROC TAPECOPY statement, then NORER is in effect for all input tape volumes and INVOL statements.
SL
specifies that the input tape is standard labeled. If you specify LABEL=(,BLP) in the DD statement for the input tape and specify SL in the INVOL statement, PROC TAPECOPY verifies that the tape is standard labeled. Do not specify SL unless the tape is actually standard labeled.
Note: If you do not specify NL or SL in the INVOL statement, the actual input tape label type determines whether PROC TAPECOPY treats the tape as nonlabeled or standard labeled, even when LABEL=(,BLP) is specified in the DD statement.

FILES Statement

Overview of the FILES Statement

FILES file-numbers;
When you want to copy particular files from an input tape, use the FILES statement to specify which files you want to copy. Use as many FILES statements as you want. Give the physical file numbers for nonlabeled tapes or for labeled tapes that are being treated as nonlabeled. Give the logical file numbers for standard labeled tapes that are not being treated as nonlabeled, even when the output tape volume is to be nonlabeled (LABEL=NL). FILE is an alias for the FILES statement.
If you are using only one input tape, the FILES statements can directly follow the PROC TAPECOPY statement. When you use several input tape volumes, follow each INVOL statement with the associated FILES statement or statements.

Specifying Individual Files

File numbers in a FILES statement can be specified in any order. For example, you might want to copy file 5 and then file 2 and then file 1, as in the following example:
proc tapecopy;
   files 5 2;
   files 1;
run;

Specifying a Range

You can specify a range of files by putting a hyphen between two file numbers, as in the following example:
proc tapecopy;
   files 1-7;
run;
In a range, the second number must be greater than the first. The keyword EOV (end of volume) can be used as the last file in a range. PROC TAPECOPY copies all files on the input tape until the end of the volume (in most cases, a double tape mark). On a nonlabeled tape, you can copy files from the input tape beyond the double tape mark by specifying the physical file number, counting tape marks as usual. If another double tape mark exists on the input tape volume, you can then specify EOV in another range.

Examples

Example 1: Copying Standard Labeled to Standard Labeled

The following job copies a standard labeled tape (volume serial XXXXXX) to another standard labeled tape (volume serial YYYYYY).
//jobname  JOB
account,name
//  EXEC SAS
//VOLIN DD UNIT=TAPE,DISP=OLD,
//  VOL=SER=XXXXXX,LABEL=(,SL),
//  DSN=first-dsname-on-tape
//VOLOUT DD UNIT=TAPE,DISP=(,KEEP),
//  VOL=SER=YYYYYY,LABEL=(,SL)
//SYSIN DD *
   proc tapecopy;
   run;
/*
//
After PROC TAPECOPY executes, the output tape volume is labeled YYYYYY.
If LABEL=(,BLP) had been specified in the input tape DD statement (VOLIN), then it would not have been necessary to use the DSN= option. Because some installations do not permit the BLP label type specification, and because no volume label checking is performed when it is specified, it is recommended that you specify (or allow to default) LABEL=(,SL).
The specification of LABEL=(,SL) in the output tape DD statement (VOLOUT) causes the operating environment to check the volume label when a tape volume is mounted on the tape drive. The operating environment ensures that a tape with volume serial YYYYYY is mounted. However, if the tape with external volume label YYYYYY were, in fact, internally labeled something other than YYYYYY, PROC TAPECOPY would fail. In this case, you would have to specify LABEL=(,BLP) or else give the actual internal volume serial in the output tape DD statement. If the output tape is not labeled internally, you can specify LABEL=(,NL) or LABEL=(,BLP).

Example 2: Copying Standard Labeled to Nonlabeled

The next job copies a standard labeled tape with volume serial TAPEIN to a nonlabeled tape, FCSTP1. After the job is executed, the output tape volume is still a nonlabeled tape, presumably with only an external volume label of FCSTP1. You must specify LABEL=NL in the PROC TAPECOPY statement. Otherwise, the procedure defaults to LABEL=SL because the first (and only) input tape volume is standard labeled.
//jobname  JOB
account,name
//  EXEC SAS
//VOLIN DD UNIT=TAPE,DISP=OLD,VOL=SER=TAPEIN,
//         LABEL=(,BLP)
//VOLOUT DD UNIT=TAPE,DISP=(,KEEP),VOL=SER=FCSTP1,
//         LABEL=(,NL)
//SYSIN DD *
   proc tapecopy label=nl;
   run;
/*
//

Example 3: Copying Nonlabeled to Nonlabeled

The following job copies a nonlabeled tape with volume serial QDR123 to a nonlabeled, 1600 bpi tape, SLXATK:
//jobname  JOB
account,name
//  EXEC SAS
//INTAPE DD UNIT=TAPE,DISP=OLD,VOL=SER=QDR123,
//          LABEL=(,NL)
//OUTTAPE DD UNIT=2927-3,DISP=(,KEEP),
//           VOL=SER=SLXATK,LABEL=(,NL)
//SYSIN DD *
   proc tapecopy indd=intape outdd=outtape
        den=1600;
   run;
/*
//

Example 4: Copying Multiple Files from One Input Tape

This next job copies the first seven files from the standard labeled input tape U02746 plus four files from the standard labeled input tape T13794 to an initially nonlabeled output tape with volume serial MINI01. After the procedure is executed, the output tape is standard labeled and has a volume serial of U02746, as specified by the COPYVOLSER option.
//jobname  JOB
account,name
//  EXEC SAS
//TAPI1 DD DISP=SHR,UNIT=TAPE,
//   VOL=SER=U02746,LABEL=(,SL),
//   DSN=first-file-dsname
//TAPI2 DD UNIT=(TAPE,,DEFER)
//OUTDDN DD DISP=(,KEEP),UNIT=TAPE,VOL=SER=MINI01,
//   LABEL=(,NL)
//SYSIN DD *
   proc tapecopy outdd=outddn indd=tapi1
        copyvolser;
      files 3 2 1;
      invol indd=tapi2 invol=t13794
         dsn='first-dsname-on-this-tape ';
      file 3;
      invol indd=tapi1;
      files 5-7 4;
      invol indd=tapi2;
      files 2 4 1;
   run;
/*
//

Example 5: Copying Multiple Files from Multiple Input Tapes

The next job copies several files from several input tape volumes to one output tape volume:
//REARRNGE JOB account,name
//  EXEC SAS
//DEN2IN DD UNIT=(2927-4,,DEFER),LABEL=(,BLP)
//DEN3IN DD UNIT=(2927-3,,DEFER),LABEL=(,SL)
//TAPE1 DD UNIT=TAPE,DISP=SHR,VOL=SER=XR8475,
//   LABEL=(,BLP)
//TAPE2 DD UNIT=TAPE,DISP=OLD,VOL=SER=BKT023,
//  DSN=first-file-dsname
//OUTPUT DD UNIT=(3400-5,,DEFER),DISP=(,KEEP)
//SYSIN DD *
   proc tapecopy label=sl den=6250 nolist
        outdd=output outvol=histpe;
      invol indd=den2in invol=ptftp0;
      files 2-4 8-eov 7 6;
      invol indd=tape1;
      files 5 7 9-eov;
      invol indd=tape2;
      files 4 5 1;
      invol indd=den3in invol=s03768
         dsn='xrt.bkt120.g0081v00';
      files 1-6 22-34;
      invol invol=so3760 dsn='t.bkt120.g0023v00';
      files 4 5 6 9;
      invol indd=tape2;
      files 7-eov;
   run;
/*
//