UNIQUE Operator
Displays unique count of field (UNIQUE Operator)
UNIQUE operator displays the unique values count for a specified numeric or character field.
Syntax -
Required Operands
- FROM - specifies ddname of the input file. It is mandatory when FROM operand is coded.
- ON (p,l,f) - specifies the field(s) used for validation.
- p - gives the starting position of field.
- l - gives the length of the field. The field should not be beyond position 32752 or the end of the record.
- f - gives the format of the data. The valid formats are PD(Signed Packed decimal - 1 to 16 bytes) and ZD (Signed Zoned decimal - 1 to 31 bytes).
Optional Operands
- VSAMTYPE - specifies the record format for a VSAM input file. It should be either F (fixed-length) or V (variable-length) record processing.
- UZERO - Causes -0 to be treated as unsigned, that is, as 0.
Example -
Scenario - Displays the unique values count for country field (2 columns length from 60th column).
INPUT1 - MATEPK.INPUT.PSFILE
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
001 PAWAN MAINFRAME JPM AP IN
002 SRINIVAS TESTING ORACLE TG IN
003 SRIDHAR SAS CG OR US
004 VENKATESH ABAP CSC CA IN
005 RAVI HADOOP CTS FL US
006 PRASAD HR INFOSYS MI US
007 RAJA TESTING IBM CA US
JCL -
----+----1----+----2----+----3----+----4----+----5----+
...
//STEP01 EXEC PGM=ICETOOL
//INDD DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//TOOLIN DD *
UNIQUE FROM(INDD) ON(60,2,CH)
/*
...
TOOLMSG (SDSF SPOOL) - Verify TOOLMSG for the return code of the submitted job.