Displays statistics of the data (STATS Operator)


STATS operator displays the minimum, maximum, average, and total statistics for specified numeric fields in the input file. For example, the average is calculated by dividing the total by the record count and rounding down to the nearest integer.

Syntax -

STATS Operator

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.
  • LMSG - Specifies the minimum, maximum, average, and total for all numeric fields are printed as 31 digits.

Example -


Scenario - Display statistics for numeric field. In the below example, we are display statistics for employee salary field (from 70-79 columns).

INPUT1 - MATEPK.INPUT.PSFILE5

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
001  PAWAN         MAINFRAME           JPM       AP        IN        0000100000 
002  SRINIVAS      TESTING             ORACLE    TG        IN        0000095000 
003  SRIDHAR       SAS                 CG        OR        US        0000080000 
004  VENKATESH     ABAP                CSC       CA        IN        0000053000 
005  RAVI          HADOOP              CTS       FL        US        0000072000 
006  PRASAD        HR                  INFOSYS   MI        US        0000066000 
007  RAJA          TESTING             IBM       CA        US        0000047000

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE5,DISP=SHR
//TOOLIN   DD *
  STATS  FROM(INDD) ON(70,10,ZD)
/*
...

TOOLMSG (SDSF SPOOL) - Verify TOOLMSG for the return code of the submitted job.

STATS TOOLMSG