STATS Operator
STATS Operator (for Beginners)
Summary
For extensive information, go through the STATS Operator for Experienced
STATS operator prints the minimum, maximum, average, and total messages for specified numeric fields in a dataset.
Syntax -

Required Operands
- FROM - FROM parameter specifies ddname of the input file.
- ON - ON operator specifies the field(s) used for DISPLAY operation.
Optional Operands
- VSAMTYPE - VSAMTYPE operand specifies the record format for a VSAM input file (F or V).
- 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
BROWSE MATEPK.INPUT.PSFILE5 Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
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
******************************** Bottom of Data ********************************
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKST JOB (123),'MATEPK',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=ICETOOL
//INDD DD DSN=MATEPK.INPUT.PSFILE5,DISP=SHR
//TOOLIN DD *
STATS FROM(INDD) ON(70,10,ZD)
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//
**************************** Bottom of Data ****************************
TOOLMSG (SDSF SPOOL) - Verify TOOLMSG for the return code of the submitted job.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9
********************************* TOP OF DATA ********************************************
1ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED
ICE650I 0 VISIT http://www.ibm.com/storage/dfsort FOR ICETOOL PAPERS, EXAMPLES AND MORE
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS: TOOLIN
ICE630I 0 MODE IN EFFECT: STOP
STATS FROM(INDD) ON(70,10,ZD)
ICE627I 0 DFSORT CALL 0001 FOR COPY FROM INDD TO E35 EXIT COMPLETED
ICE628I 0 RECORD COUNT: 000000000000007
ICE607I 0 STATISTICS FOR (70,10,ZD) :
ICE608I 0 MINIMUM: +000000000047000, MAXIMUM: +000000000100000
ICE609I 0 AVERAGE: +000000000073285, TOTAL : +000000000513000
ICE602I 0 OPERATION RETURN CODE: 00
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE: 00
******************************** BOTTOM OF DATA ******************************************
Explaining Solution -
- INDD - Specifies the ddname for input file.
- TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
- TOOLMSG - Specifies where to write the ICETOOL processing messages.
- DFSMSG - Specifies where to write the DFSORT processing messages.
- STATS FROM(INDD) ON(70,10,ZD) - Prints the maximum, minimum, average etc of the key field(salary 70-79 columns) specified in criteria.