ICETOOL - OCCUR Operator


Print each unique value for specified numeric or character fields and how many times it occurs in a separate list of the data set.

Simple or tailored reports can be produced.

The values printed can be limited to value count that meets specified criteria.


Syntax: -



From 1 to 10 ON fields can be specified if the resulting list data set line length does not exceed the limit specified by the WIDTH operand or 8192 bytes.

All ON fields are used to determine whether a record contains a unique value or not.


Required Operands: -


FROM -

Specifies the input data set ddname.

DD statement must supply for the ddname specified.


LIST -

Specifies the list data set ddname.

DD statement must supply for the ddname specified.


ON -

Specifies the field to be used for this operation.

From 1 to 50 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.

– (p,m,f,formatting) gives the position, length and format of a numeric or character field. Specifies how the data is to be formatted for printing for this 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: -


TITLE, PAGE, DATE, DATENS, YDDD, YDDDNS, TIME and TIMENS –

Specifies the elements to appear in the title lines at the top of each page.

Only specified elements appear in the order given.

Each title string can consist up to three individual strings.

A string can be 1 to 50 characters.

The maximum length of each title string can be 50 characters.


TLEFT -

Specifies title strings are left-justified with respect to 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 field.

A heading string can be 1 to 50 characters.

NONE can be used to suppress the heading for the corresponding ON field.


NOHEADER -

Suppresses the heading line.


LINES -

Specifies the number of lines per page.

n can be 10 to 999.


BLANK and PLUS -

Causes the column widths to be dynamically adjusted as needed.

Suppresses leading zeros for numeric fields.

BLANK causes a blank, rather than a + to be used for the positive sign.


ALLDUPS, NODUPS, HIGHER, LOWER, EQUAL –

Limits the values to be printed to those occurrences meet the given criteria.

x, y, and v must be specified.

n or +n where n can be 1 to 15 decimal digits.


VSAMTYPE -

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


WIDTH -

Specifies the line length and LRECL for the list data set.

n can be 121 to 8192.

If the WIDTH specified is less than the calculated line length, ICETOOL terminates the operation.

If WIDTH is not specified, the calculated line length is used as the line length and LRECL for the list data set.


LONGLINE -

If WIDTH(n) is not specified, allows the calculated line length to be up to 8192 bytes.


INDENT -

Specifies the number of blanks used to indent the report.

Overriding the default of 0.

n can be 0 to 50.


BETWEEN -

Specifies the number of blanks used between the columns of data.

Overriding the default of 3.

n can be 0 to 50.


TBETWEEN -

Specifies the number of blanks used between title elements.

Overriding the default of 8.

n can be 0 to 50.


UZERO -

Causes -0 to be treated as unsigned, that is, as +0.


LISTSDB -

Uses SDB for the list data set (overrides installation value SDBMSG=NO).


LISTNOSDB -

Specifies it does not use SDB for the list data set (overrides installation value SDBMSG=YES).


Example: -

Below example to display the occurrences of the employees based on the country level(from 60th column of length 2 characters).


Input: -

MTHUSR.INPUT.DATASET -


JCL: -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKR JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),         
//             NOTIFY=&SYSUID                                           
//*                                                                     
//STEP01   EXEC PGM=ICETOOL                                             
//INDD     DD DSN=MTHUSR.INPUT.DATASET,DISP=SHR                         
//OUTDD1   DD DSN=MTHUSR.OUTPUT.DATASET1,                               
//            DISP=(NEW,CATLG,DELETE),                                  
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,                        
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)              
//TOOLIN   DD *                                                         
  OCCUR FROM(INDD) LIST(OUTDD1) -                                       
        TITLE('EMPLOYEES COUNT: COUNTRY LEVEL') -                       
        ON(60,2,CH) ON(VALCNT)                                          
/*                                                                      
//TOOLMSG  DD DSN=MTHUSR.OUTPUT.TOOLMSG1,DISP=SHR                       
//DFSMSG   DD SYSOUT=*                                                  
//                                                                      
**************************** Bottom of Data ****************************


OUTPUT: -

TOOLMSG: -


MTHUSR.OUTPUT.DATASET1: -


Explaining Solution: -

  • INDD - Specifies the ddname for input dataset.
  • OUTDD1 - Specifies the ddname for output dataset.
  • TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
  • TOOLMSG - Specifies ICETOOL message data set.
  • DFSMSG - Specifies DFSORT message data set.
  • OCCUR FROM(INDD) LIST(OUTDD1)
    TITLE('EMPLOYEES COUNT: COUNTRY LEVEL')
    ON(60,2,CH) ON(VALCNT)
    - Writes the employee record occurrences to the OUTDD1 based on the selection criteria which is from 60th position of length 2.