ICETOOL - COPY Operator


Copies an input data set to one or more output data sets.

Multiple outputs are handled using a single pass over the input.


Syntax: -



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: -


FROM

Specifies ddname of the input data set.

DD statements must supply for the ddnames specified.


JKFROM

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.


TO

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.


USING

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: -


VSAMTYPE

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: -


JCL: -

//MTHUSRR JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),  
//             NOTIFY=&SYSUID                                    
//*                                                              
//STEP01   EXEC PGM=ICETOOL                                      
//INDD     DD DSN=MTHUSR.INPUT.DATASET,DISP=SHR                  
//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')                                
/*                                                               
//TOOLMSG  DD DSN=MTHUSR.OUTPUT.TOOLMSG1,DISP=SHR                
//DFSMSG   DD SYSOUT=*                                           
//                                                               

OUTPUT: -

TOOLMSG: -


MTHUSR.OUTPUT.DATASET1: -


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.