Summary -

In this topic, we described about the below sections -

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

Syntax -

UNIQUE Operator

Required Operands


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


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


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


UNIQUE Operator

JCL: -

***************************** Top of Data **************************
//             NOTIFY=&SYSUID                                           
//STEP01   EXEC PGM=ICETOOL                                             
//INDD     DD DSN=MTHUSR.INPUT.DATASET,DISP=SHR                         
//TOOLIN   DD *                                                         
  UNIQUE FROM(INDD) ON(60,2,CH)                                         
//DFSMSG   DD SYSOUT=*                                                  
**************************** Bottom of Data *************************

UNIQUE Operator



UNIQUE Operator

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.