OCCUR Operator
OCCUR Operator (for Beginners)
Summary
For extensive information, go through the OCCUR Operator for Experienced
OCCUR operator prints each unique occurrence and how many times they occur for specified numeric/character fields in a separate list file.
Syntax -

Required Operands
- FROM - FROM parameter specifies ddname of the input file.
- LIST - listdd specifies the list dataset ddname to be created by ICETOOL LIST operation.
- ON - ON operator specifies the field(s) used for DISPLAY operation.
Optional Operands
- TITLE, PAGE, DATE, DATENS, YDDD, YDDDNS, TIME and TIMENS - Specify the elements in the title lines at the top of each page.
- TLEFT - Specifies title strings are left-justified for each other.
- TFIRST - Specifies the title lines are only printed on the first page.
- NOCC - Suppresses carriage control characters.
- HEADER - Specifies one, two, or three lines heading to be printed for the corresponding ON the field.
- NOHEADER - Suppresses the heading line.
- LINES - Specifies the number of lines per page.
- BLANK and PLUS - BLANK causes a blank, rather than a PLUS for the positive sign.
- ALLDUPS, NODUPS, HIGHER, LOWER, EQUAL – Limits the count values to those occurrences that meet the given criteria.
- VSAMTYPE - VSAMTYPE operand specifies the record format for a VSAM input file (F or V).
- WIDTH - Specifies the line length and LRECL length for the list data set.
- LONGLINE - Specifies the calculated line length to be a maximum of 8191 bytes.
- INDENT - Specifies the number of blanks used to indent the report.
- BETWEEN - Specifies the number of blanks used between the data columns.
- TBETWEEN - Specifies the number of blanks used between title elements.
- UZERO - Causes -0 to be treated as unsigned, that is, as 0.
- LISTSDB - LISTSDB specifies to ICETOOL that the BLKSIZE should select as the system-determined optimum block size for the LIST data set in the same way as for installation option SDBMSG=YES.
- LISTNOSDB - LISTSDB specifies to ICETOOL that the BLKSIZE should select as the system-determined optimum block size for the LIST data set in the same way as for installation option SDBMSG=NO.
Example -
Scenario - Display the number of employees based on the country code(two characters from the 60th column).
INPUT - MATEPK.INPUT.PSFILE
BROWSE MATEPK.INPUT.PSFILE 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
002 SRINIVAS TESTING ORACLE TG IN
003 SRIDHAR SAS CG OR US
004 VENKATESH ABAP CSC CA US
005 RAVI HADOOP CTS FL US
006 PRASAD HR INFOSYS MI US
007 RAJA TESTING IBM CA US
******************************** Bottom of Data ********************************
JCL -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKIT JOB (123),'MATEPK',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//STEP01 EXEC PGM=ICETOOL
//INDD DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD DD DSN=MATEPK.OUTPUT.PSFILEO,
// DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
// SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
// DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN DD *
OCCUR FROM(INDD) LIST(OUTDD) -
TITLE('EMPLOYEES COUNT: COUNTRY LEVEL') -
ON(60,2,CH) ON(VALCNT)
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//
**************************** Bottom of Data ****************************
OUTPUT - MATEPK.OUTPUT.PSFILEO
BROWSE MATEPK.OUTPUT.PSFILEO Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
EMPLOYEES COUNT: COUNTRY LEVEL
(60,2,CH) VALUE COUNT
IN 000000000000002
US 000000000000005
******************************** 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
OCCUR FROM(INDD) LIST(OUTDD) -
TITLE('EMPLOYEES COUNT: COUNTRY LEVEL') -
ON(60,2,CH) ON(VALCNT)
ICE643I 0 WIDTH OF REPORT IS 0121 BYTES
ICE627I 0 DFSORT CALL 0001 FOR SORT FROM INDD TO E35 EXIT COMPLETED
ICE603I 0 INFORMATION PRINTED IN OUTDD DATA SET
ICE628I 0 RECORD COUNT: 000000000000007
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA: 000000000000002
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.
- OUTDD - Specifies the ddname for output 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.
- COPY FROM(INDD) TO(OUTDD) - Copies all the records from INDD file to OUTDD file.
- OCCUR FROM(INDD) LIST(OUTDD1)
TITLE('EMPLOYEES COUNT: COUNTRY LEVEL')
ON(60,2,CH) ON(VALCNT) - Writes the employee record occurrences to the OUTDD based on the selection criteria.