ICETOOL - RANGE Operator


Prints a message containing the count of values in a specified range for a specified numeric field in a data set.

Prints a message in TOOLMSG.


Syntax: -



The range can be specified as higher than x, lower than y, higher than x and lower than y, equal to v, or not equal to w.

x, y, v and w are signed or unsigned decimal values.


Required Operands: -


FROM -

Specifies the ddname of the input data set.

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.

– VLEN is equivalent to ON(1,2,BI) for variable-length records, represents the record length for each record.


HIGHER, LOWER, EQUAL, NOTEQUAL –

Defines the range for the values to be counted.

HIGHER and LOWER may be used together or separately.

EQUAL and NOTEQUAL must be used separately.

x, y, v and w must be specified as n, +n, or -n where n can be 1 to 31 digits.


Optional Operands: -


VSAMTYPE -

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


Example: -

Below example to display the range of the employee number(from 1st column of length 3 characters) greater than 2 and less than 6.


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                         
//TOOLIN   DD *                                                         
  RANGE FROM(INDD) ON(1,3,ZD) HIGHER(2) LOWER(6)                        
/*                                                                      
//TOOLMSG  DD DSN=MTHUSR.OUTPUT.TOOLMSG1,DISP=SHR                       
//DFSMSG   DD SYSOUT=*                                                  
//                                                                      
**************************** Bottom of Data ****************************


OUTPUT: -

TOOLMSG: -


Explaining Solution: -

  • INDD - Specifies the ddname for input dataset.
  • TOOLIN DD * - Specifies the ICETOOL statements for DFSORT.
  • TOOLMSG - Specifies ICETOOL message data set.
  • DFSMSG - Specifies DFSORT message data set.
  • RANGE FROM(INDD) ON(1,3,ZD) HIGHER(2) LOWER(6) - Writes the count of the records in between the higher and lower values specified based on the selection criteria from 1st column of length 3.