ICETOOL - UNIQUE Operator


Prints a message containing the count of unique values for a specified numeric or character field.


Syntax: -



Required Operands


FROM -

Specifies the ddname of the input data set.

DD statement must supply for the ddname specified.


ON -

Specifies a field to be used for this operation.

From 1 to 10 ON fields can be specified.

(p,m,f) gives the position, length and format of a numeric or character field. A field must not extend beyond position 32752 or the end of the record.

VLEN is equivalent to ON(1,2,BI) for variable-length records, represents the record length for each record.


Optional Operands


VSAMTYPE -

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


UZERO -

Causes -0 to be treated as unsigned, that is, as +0.


Example: -

Below example to get the unique count of the employee countries (from 60th column of length 2).


Input: -

MTHUSR.INPUT.DATASET -


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.DATASET,DISP=SHR                         
//TOOLIN   DD *                                                         
  UNIQUE FROM(INDD) ON(60,2,CH)                                         
/*                                                                      
//TOOLMSG  DD DSN=MTHUSR.OUTPUT.TOOLMSG1,DISP=SHR                       
//DFSMSG   DD SYSOUT=*                                                  
//                                                                      
**************************** Bottom of Data ****************************


OUTPUT: -

TOOLMSG: -


Explaining Solution: -

  • INDD - Specifies the ddname for input dataset.
  • TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
  • TOOLMSG - Specifies ICETOOL message data set.
  • DFSMSG - Specifies DFSORT message data set.
  • UNIQUE FROM(INDD) ON(60,2,CH) - Prints the number of unique records count in TOOLMSG based on the selection criteria field from 60th position of length 2.