ICETOOL - SUBSET Operator


Selects records from a data set based on keeping or removing header records, relative records or trailer records.

Records that are not selected can be saved in a separate output data set.

Selects input or output records from the indd data set for inclusion in the outdd data set based on meeting criteria for keeping or removing the first n records, specific relative record numbers, and/or the last n records.

From 1 to 300 relative records or ranges of relative records can be specified.

DISCARD(savedd) can be used to save the records which do not meet the criteria.

DISCARD(savedd) may be used with or without TO(outdd).

The DFSORT control statements in xxxxCNTL are used if USING(xxxx) is specified.


Syntax: -



Required Operands: -


FROM -

Specifies the ddname of the input data set.

DD statement must supply for the ddname specified.


TO -

Specifies the ddname of the output data set.

DD statement must supply for the ddname specified.


DISCARD -

Specifies the ddname of the output data set for the records which are not selected.

DD statement must supply for the ddname specified.

TO(outdd) and DISCARD(savedd) may be used together or separately.


KEEP, REMOVE –

Indicates whether the records that meet the criteria are kept or removed.


INPUT, OUTPUT –

Indicates whether the criteria are to be applied to the input records or output records.


Optional Operands: -


HEADER, FIRST, TRAILER, LAST, RRN –

Specifies the header records (first u records), trailer records (last v records) and/or relative records to be kept or removed.

RRN(q,*) can be used to specify relative records q through the last record.

From 1 to 300 RRN operands can be specified.

u, v, q and r must be specified as n or +n where n can be 1 to 999999999999999.


USING –

Specifies the first 4 characters of the ddname (xxxxCNTL) for the DFSORT control statement data set.


VSAMTYPE –

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


Example: -

Below example to copy only data employee records (exclude header and footer).


Input: -

MTHUSR.INPUT.DATASET3 -


JCL: -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MTHUSRR JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),         
//             NOTIFY=&SYSUID                                           
//*                                                                     
//STEP01   EXEC PGM=ICETOOL                                             
//INDD     DD DSN=MTHUSR.INPUT.DATASET3,DISP=SHR                        
//OUTDD    DD DSN=MTHUSR.OUTPUT.DATASET1,                               
//            DISP=(NEW,CATLG,DELETE),                                  
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                        
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)              
//TOOLIN   DD *                                                         
  SUBSET FROM(INDD) TO(OUTDD) REMOVE OUTPUT HEADER(2) TRAILER(2)        
/*                                                                      
//TOOLMSG  DD DSN=MTHUSR.OUTPUT.TOOLMSG1,DISP=SHR                       
//DFSMSG   DD SYSOUT=*                                                  
//                                                                      
**************************** Bottom of Data ****************************


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.
  • TOOLMSG - Specifies ICETOOL message data set.
  • DFSMSG - Specifies DFSORT message data set.
  • SUBSET FROM(INDD) TO(OUTDD) REMOVE OUTPUT HEADER(2) TRAILER(2) - Selects the subset of the records from the input which ignores first 2 records and last 2 records.