TAPECOPY command

This section provides an overview of the Troubleshooting command TAPECOPY.

Usage

The TAPECOPY command is a utility tool that you can use to select a specified subset or all records from an input data set, and copy them to an output data set. The selection logic is identical to that used for the DUMP command.

Usage notes

  • The TAPECOPY command defines options for the data set copy module.
  • Copies of selected portions of the input data set are produced on a user-specified output data set.

Syntax

Read syntax diagramSkip visual syntax diagramtape copy nameTAPECOPY(EXEC(INPUTDD)OFFSET(4integer)CODES(codelist)SKIP(0integer)STOPAFT(0integer)NEWCOPY(ddname))

Subcommand options

tape copy name
A user-defined name identifying the records copied. If this field is omitted, the records are identified by the name COPY0001.

Ensure that the specified name is not the same as a OMEGAMON for Db2 PE command keyword or abbreviation.

EXEC
Specifies INPUTDD as the ddname of the input data set. INPUTDD is the only valid ddname for this option and must be specified.
OFFSET
The offset of the record code into the record. The record code is a 1-byte field at position offset-plus-1. For example, OFFSET(4) defines a record code in the fifth byte of the record. The offset must be a numeric value less than the actual length of the record. The maximum value is 999 999 999. The default is 4.
CODES
The code values for records to be processed. Each code is a 2-digit hexadecimal number. You can specify either of the following:
  • A list of values, for example '01,02,03'
  • A range of values, for example '01-03,05-07'

Each entry must be separated by a comma. Enclose the code list in quotes if more than one value is specified.

If this option is omitted, all record codes (00-FF) are processed.

SKIP
The number of records that are skipped before processing begins. The maximum value is 999 999 999.

The default is 0. If 0 is specified, processing begins with the first record.

STOPAFT
The number of records to be processed, starting after the number of records to be skipped (SKIP option). The maximum value is 999 999 999.

The default is 0. This causes all records (after skipping, if specified) to be processed.

NEWCOPY
The ddname of the output data set. The default is TAPECOPY.

Example using TAPECOPY

In this example:
  • The TAPECOPY is named COPYSTAT.
  • The ddname of the input data set is INPUTDD (the GLOBAL default).
  • The offset of 4 defines a record code in the fifth byte of the record.
  • Only records with a value of 01 or 02 in the fifth byte are copied.
  • The first 50 records of the input data set are skipped.
  • The next 10 records that meet the specifications are copied.
  • The ddname of the output data set is OUTDATA.
COPYSTAT TAPECOPY(
EXEC    (INPUTDD)
OFFSET  (4)
CODES   ('01,02')
SKIP    (50)
STOPAFT (10)
NEWCOPY (OUTDATA))

Sample JCL for DUMP and TAPECOPY commands

The following figure shows a sample JCL for the DUMP and TAPECOPY commands.
Note: The command syntax shown below is not appropriate in all circumstances. You must modify it to meet your requirements and system setup.
Figure 1. Sample JCL for the DUMP and TAPECOPY commands
//TPCDUMP1 JOB	   (INSTALLATION DEPENDENCIES)
//*
//*
//*****************************************************************
//*
//*
COPY INPUT DATA FILE TO SYSPRINT OR AN OUTPUT DATA FILE
//*
//*****************************************************************
//*
//	PEMAIN EXEC PGM=FPECMAIN
//STEPLIB  DD  DSN=FPE.FPELIB.RKANMOD,DISP=SHR
//SYSPRINT DD  SYSOUT=X
//SYSOUT   DD  SYSOUT=X
//*
//*	
---    INPUT DATA SET   ---
//*
//INPUTDD  DD  DSN=FPE.FPELIB.INPUT1,DISP=SHR
//*
//*	
---   OUTPUT DATA SET   ---
//*
//OUTDATA  DD  DSN=FPE.FPELIB.OUTPUT1,
//	       DISP=(NEW,CATLG),
//	       UNIT=SYSDA,SPACE=(TRK,(10,10),RLSE),
//	       DCB=(RECFM=VB,LRECL=4092,BLKSIZE=4096)
//*
//SYSIN    DD  *
*
*	
---  TAPECOPY COMMAND EXAMPLE   ---
*
COPY0001 TAPECOPY (EXEC(INPUTDD),SKIP(125),STOPAFT(10),NEWCOPY(OUTDATA))
*
*
*	
---  DUMP COMMAND EXAMPLE   ---
*
DUMP0001 DUMP (EXEC(INPUTDD),SKIP(125),STOPAFT(10),MAXDUMP(1000))
EXEC
*
*