Summary -

In this topic, we described about the below sections -

Copies an input data set to one or more output data sets. Multiple outputs are handled using a single pass over the input.

Syntax -

COPY Operator

Copies the indd data set to the outdd data sets (up to 10). The DFSORT control statements are used in xxxxCNTL if USING(xxxx) is specified. DFSORT control statements and options can be used to copy a subset of the input records, reformat records for output and so on.

Required Operands: -


Specifies ddname of the input data set. DD statements must supply for the ddnames specified.


Used for a JOINKEYS application. JKFROM must provide for USING(xxxx) operand. In xxxxCNTL, a JOINKEYS statement must provide with F1=ddname1 for the F1 file and a JOINKEYS statement with F2=ddname2 for the F2 file, as well as JOIN and REFORMAT statements as needed.


Specifies ddnames of 1 to 10 output data sets. DD statements must supply for the ddnames specified. TO, USING or TO and USING must be specified.


Specifies first 4 characters of the ddname (xxxxCNTL) for the DFSORT control statement data set. DD statement must supply for xxxxCNTL if USING(xxxx) specified. TO, USING, or TO and USING must be specified.

Optional Operands: -


Specifies the record format for a VSAM input data set (F or V).

Example: -

Below example to copy the employee records to output dataset whose country is ‘IN’(from 60th column of length 2).

Input: -

COPY Operator

JCL: -

//             NOTIFY=&SYSUID                                    
//STEP01   EXEC PGM=ICETOOL                                      
//OUTDD    DD DSN=MTHUSR.OUTPUT.DATASET,                        
//            DISP=(NEW,CATLG,DELETE),                           
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                 
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)       
//TOOLIN   DD *                                                  
  COPY FROM(INDD) TO(OUTDD) USING(CTL1)                          
//CTL1CNTL DD *                                                  
  INCLUDE COND=(60,2,CH,EQ,C'IN')                                
//DFSMSG   DD SYSOUT=*                                           
COPY Operator



COPY Operator


COPY Operator

Explaining Solution: -

  • INDD - Specifies the ddname for input dataset.
  • OUTDD - Specifies the ddname for output dataset.
  • TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
  • CTL1CNTL DD * - Specifies the DFSORT statements for processing.
  • TOOLMSG - Specifies ICETOOL message data set.
  • DFSMSG - Specifies DFSORT message data set.
  • COPY FROM(INDD) TO(OUTDD) USING(CTL1) - Copies the data from INDD to OUTDD based on the USING condition specified in CTL1.
  • INCLUDE COND=(60,2,CH,EQ,C'IN') – CTL1 condition specified is the rows which had ‘IN’ from 60th position of length 2.