ICETOOL Complete Tutorial Alternative to DFSORT

What is ICETOOL

ICETOOL, a versatile data set processing and reporting utility, provides an easy-to-use batch front-end for DFSORT.

How to use ICETOOL

ICETOOL combines new features with previously available DFSORT features to perform complex sorting, copying, reporting, join, match and analytical tasks using multiple data sets in a single job step.

Also Read: Sorting Multiple Fields in DFSORT

Major operators in ICETOOL

COPY – copies a data set to one or more output data sets. Multiple output is handled using a single pass over the input.

COUNT – prints a message containing the count of records in a data set. Can also be used to set RC=12, RC=4 or RC=0 based on the count of records in a data set (that is, empty, not empty, higher, lower, equal or not equal).

DEFAULTS – prints the DFSORT installation defaults in a separate list data set.

DISPLAY – prints the values and characters of specified numeric and character fields in a separate list data set. Simple, tailored or sectioned reports can be produced.

MODE – sets/resets scanning and error actions.

OCCUR – prints each unique value for specified numeric and character fields, and the number of times it occurs, in a separate list data set. Simple or tailored reports can be produced. The values printed can be limited to those for which the value count meets specified criteria (that is, all duplicates, no duplicates, higher, lower or equal).

RANGE – prints a message containing the count of values in a range (that is, higher, lower, equal or not equal) for a numeric field.

SELECT – selects records for an output data set based on meeting criteria (that is, all duplicates, no duplicates, first, last, first duplicate, last duplicate, higher, lower or equal) for the number of times numeric or character field values occur. Records that are not selected can be saved in a separate output data set.

SORT – sorts a data set to one or more output data sets. Multiple output is handled using a single pass over the input.

SPLICE – splices together fields from records that have the same numeric or character field values (that is, duplicate values), but different information. Fields from two or more records can be combined to create an output record. The fields to be spliced can originate from records in different data sets, so you can use SPLICE to do various “join” and “match” operations.

STATS – prints messages containing the minimum, maximum, average, and total of values in numeric fields.

UNIQUE – prints a message containing the count of unique values in a numeric or character field.

VERIFY – prints a message identifying each invalid value found in decimal fields.

ICETOOL Utility Syntax

The DFSORT ICETOOL utilities are both easy to use and very helpful. You invoke them with the following JCL:

//jobname JOB …

//stepname EXEC PGM=ICETOOL

//TOOLMSG DD SYSOUT

[ICETOOL writes its messages here. RECFM=FBA,LRECL=121 are built in.]

//DFSMSG DD SYOUT=A

[DFSORT messages are written here. RECFM=FBA,LRECL=121 are built in.]

//in-ddname DD DSN=data-set-name,DISP=SHR

[You usually must include a DD statement describing the input data set.]

//TOOLIN DD * [RECFM=FB,LRECL=80 are built in.]

[ICETOOL statements]

/*

You code ICETOOL statements in columns 1 to 72. To continue a statement, place a dash (- ) after any complete operand and continue the statement in any column (1 to 72) on the next line.

COPY FROM(INDD) – TO(OUTDD)

You can code several ICETOOL statements in one job step.

UNIQUE FROM(INDD) ON(1,10,CH)

COPY FROM(INDD) TO(INDD)

Several ICETOOL statements require you to specify fields in the following form:

ON(start,length,format)

The start is the starting byte position. For a fixed-length record, the first byte is 1. For a variable-length data set, the first data byte is 5. The length is the length of the field in bytes.

The format is the format of the field as shown in Table 19.1. Formats BI Unsigned binary, 1–4 bytes FI Signed fixed point, 1–4 bytes PD Signed packed decimal, 1–8 bytes ZD Signed zoned decimal, 1–15 bytes FS Signed numeric with optional leading floating point, 1–16 bytes CH Character, 1–80 bytes

Most statements let you define several fields in one statement:

UNIQUE FROM(INDD) ON(1,10,CH) ON(11,4,BI) ON(15,10,CH)

COPY Data Sets To copy a data set, code the COPY statement as follows:

COPY FROM(in-ddname) TO(out-ddname) [You can write 1 to 10 TO(out-ddname) parameters to copy the FROM data set to as many as 10 output data sets. Include a //out-ddname

DD statement for each output data set.] Select Records To select and copy records, code the SELECT statement as follows:

SELECT FROM(in-ddname) TO(out-ddname) ON(start,length,format) option

ICETOOL makes one pass of the data to read the in-ddname data set and count occurrences of values in the field specified.

Then it makes a second pass to select the records based on the field counts and write them into the out-ddname data set. Code one of the following options to select the records.

ALLDUPS selects records in which a value in the field occurs more than once.

NODUPS selects records in which a value in the field occurs only once.

HIGHER(n) selects records in which a value in the field occurs more than n times (n can be 1 to 99).

LOWER(n) selects records in which a value in the field occurs less than n times (n can be 1 to 99). EQUAL(n) selects records in which the field value occurs exactly n times (n can be 1 to 99).

FIRST selects only the first record of a group in which the field value occurs more than once.

LAST selects only the last record of a group in which the field value occurs more than once. The following selects only records in which the binary field in columns 4 to 7 contains a value found in no other record.

SELECT FROM(INDD) TO(OUTDD) ON(4,4,BI) NODUPS

You can specify 1 to 10 ON parameters. ICETOOL treats the multiple fields as if they were one long field for counting duplicate values.

Here, ICETOOL looks at columns 10 to 13 and 20 to 23 as if they were one field and selects records in which these eight columns contain a character string not found in other records.

SELECT FROM(INDD) TO(OUTDD) ON(10,4,CH) ON(20,4,CH) NODUPS

Count Records

To count and print the number of records in a data set, code the COUNT statement as follows: COUNT FROM(in-ddname)

Print Ranges for Numeric Data To print the minimum, maximum, average, and total for numeric fields, code the STATS statement as:

STATS FROM(in-ddname) ON(start,length,format)

You can code from 1 to 10 ON parameters to gather statistics on multiple fields.

The format must be numeric. CH is not allowed. Print Count of Unique Values in a Field To print a count of the unique values in a field, that is, a count of those values that occur only once, code the UNIQUE statement as

UNIQUE FROM(in-ddname) ON(start,length,format) —-> Code only one ON parameter.

Print Values in a Data Set

To print the values of fields within a data set, code the DISPLAY statement as

DISPLAY FROM(in-ddname) ON(start,length,format) LIST(ddname)

Include a //ddname DD statement to print the output. You can code 1 to 20 ON parameters to print multiple fields.

DISPLAY has many other options that give it the power of a report writer, but these are beyond the scope of this book.

Print the Number of Times Values Occur

To print the number of times values within a field occur, code the OCCURS statement as follows:

OCCURS FROM(in-ddname) ON(start,length,format) LIST(ddname)

ICETOOL prints the number of times each unique value within the field occurs. Include a //ddname DD statement to print the output. You can code 1 to 10 ON parameters to display values for multiple fields.

You can also display the value and counts for fields meeting selection criteria by including an option.

(The default is to display all unique values.)

OCCURS FROM(in-ddname) ON(start,length,format) LIST(ddname) option

The option can be one of the following:

ALLDUPS displays the value and count for field values that occur more than once.

NODUPS displays the value and count for field values that occur only once.

HIGHER(n) displays the value and count for field values that occur more than n times.

LOWER(n) displays the value and count for field values that occur less than n times. EQUAL(n) displays the value for field values that occur exactly n times.

This displays records that have characters in columns 1 to 10 found in no other records.

OCCURS FROM(INDD) ON(1,10,CH) LIST(PRINTIT)

NODUPS – Print a Count of Values within a Specified Range RANGE is like OCCURS, except you can specify criteria for the field for counting.

That is, ICETOOL prints a count of records meeting criteria.

You code RANGE as

RANGE FROM(in-ddname) ON(first,length,format) LIST(ddname) options

The format must be numeric. CH is not allowed.

The option can be one of the following:

HIGHER(n) prints a count of the records with the field having a value higher than n.

LOWER(n) prints a count of the records with the field having a value lower than n.

HIGHER(n1) LOWER(n2)

prints a count of the records with the field having a value higher than n1 and lower than n2.

EQUAL(n) prints a count of the records with the field having a value equal to n.

NOTEQUAL(n) prints a count of the records with the field having a value not equal to n.

This prints a count of the records in which the binary field in columns 1 to 4 contains a value of 100 through 200.

RANGE FROM(INDD) ON(1,4,BI) LIST(PRINTIT) HIGHER(99) LOWER(201)

Print Records Having Invalid Values in a Decimal Field To print a message identifying invalid decimal data in a field, code the

VERIFY statement as

VERIFY FROM(in-ddname) ON(start,length,format) The format must be PD or ZD. You can code 1 to 10 ON parameters.

Sorting Records

SORT FROM(in-ddname) TO(out-ddname) USING(xxxx)

The in-ddname is the ddname of the input data set. The out-ddname is the ddname of the output data set.

// EXEC PGM=ICETOOL

//TOOLMSG DD SYSOUT

//DFSMSG DD SYOUT=A

//DDIN DD DSN=A1000.TEST.DATA,DISP=SHR

//DDOUT DD DSN=A1000.SORTED.DATA,DISP=(NEW,CATLG),

// UNIT=SYSDA,RECFM=FB,LRECL=80,

// SPACE=(0,(100,20))

//SORTCNTL DD DSN=A1000.SORTCNTL.DATA,DISP=SHR

[You would store the DFSORT control statements in this data set.]

//TOOLIN DD * SORT FROM(DDIN) TO(DDOUT) USING(SORT)

/*

Related Posts

Get new content delivered directly to your inbox.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.