ICETOOL: Do Complex Tasks Easily

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

DFSORT. 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.

The sixteen ICETOOL operators briefly described below provide new tools for programmers:

_ 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 create an output

data set containing text and the count, or to set RC=12, RC=8, 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).

_ DATASORT – sorts data records between header and trailer records in a data set to an output data set.

_ 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. Maximums, minimums, totals, averages and counts can

be produced.

_ MERGE – merges one or more data sets to one or more output data sets. Multiple output is handled using a

single pass over the input.

_ 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).

DFSORT: Beyond Sorting 3

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

for a numeric field.

_ RESIZE – Creates a larger record from multiple shorter records, or creates multiple shorter records from a

larger record, that is, resizes fixed length records.

_ 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.

_ SUBSET – selects records from a data set based on keeping or removing header records, relative records or

trailer records. Records that are not selected can be saved in a separate output data set.

_ 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.

Here’s an example of the JCL and control statements for an ICETOOL job. Other ICETOOL examples can be

found in DFSORT Application Programming Guide, in DFSORT: Getting Started, and in “Sources of Information:

Empower Programmers”.

4 DFSORT

//EXAMP JOB A492,PROGRAMMER

//TOOL EXEC PGM=ICETOOL

//TOOLMSG DD SYSOUT=A

//DFSMSG DD SYSOUT=A

//TOOLIN DD *

* Statistics from all branches

STATS FROM(ALL) ON(18,4,ZD) ON(28,6,PD) ON(22,6,PD)

* Books from VALD and WETH

SORT FROM(BKS) TO(DAPUBS,PRPUBS) USING(SPUB)

* Separate output for California and Colorado branches

SORT FROM(ALL) USING(CACO)

* California branches profit analysis

RANGE FROM(CADASD) ON(28,6,PD) HIGHER(-1500) LOWER(+8000)

* Branches with less than 32 employees

RANGE FROM(ALL) ON(18,4,ZD) LOWER(32)

* Print a report for the Colorado branches

DISPLAY FROM(CODASD) LIST(RPT) –

YDDD(YD/) TITLE(‘Colorado Branches Report’) PAGE –

HEADER(,’City’) ON(1,15,CH) –

HEADER(‘Profit/Loss’,'(thousands)’) ON(28,6,PD,E1,U12) –

HEADER(‘Employees’,'(thousands)’) ON(18,4,ZD,A1,U05) –

BLANK BETWEEN(5) –

TOTAL(‘Total’) AVERAGE(‘Average’) –

MINIMUM(‘Lowest’) COUNT(‘Number of cities’)

* Print a report of books for individual publishers

DISPLAY FROM(DAPUBS) LIST(SECTIONS) –

TITLE(‘BOOKS FOR INDIVIDUAL PUBLISHERS’) PAGE –

HEADER(‘TITLE OF BOOK’) ON(1,35,CH) –

HEADER(‘PRICE OF BOOK’) ON(170,4,BI,C1,F’$’) –

BTITLE(‘PUBLISHER:’) BREAK(106,4,CH) –

BAVERAGE(‘AVERAGE FOR THIS PUBLISHER’) –

BTOTAL(‘TOTAL FOR THIS PUBLISHER’) –

AVERAGE(‘AVERAGE FOR ALL PUBLISHERS’) –

TOTAL(‘TOTAL FOR ALL PUBLISHERS’)

DFSORT: Beyond Sorting 5

* Print the count of books in use from each publisher

OCCUR FROM(BKIN) LIST(PUBCT) BLANK –

TITLE(‘Books from Publishers’) DATE(DMY.) –

HEADER(‘Publisher’) HEADER(‘Books Used’) –

ON(106,4,CH) ON(VALCNT,N05)

* Separate output containing records for publishers

* with more than 4 books in use

SELECT FROM(BKIN) TO(BKOUT) ON(106,4,CH) HIGHER(4)

* Reformat REGION.IN1 to T1 so it can be spliced

COPY FROM(REGNIN1) TO(T1) USING(CTL1)

* Reformat REGION.IN2 to T1 so it can be spliced

COPY FROM(REGNIN2) TO(T1) USING(CTL2)

* Splice records in T1 with matching ON fields

SPLICE FROM(T1) WITHALL –

ON(5,5,CH) – Region

WITH(1,4) – Office

WITH(25,4) – Employees

WITH(29,10) – Evaluation

TO(REGNOUT)

/*

//ALL DD DSN=A123456.SORT.BRANCH,DISP=SHR

//BKS DD DSN=A123456.SORT.SAMPIN,DISP=SHR

// DD DSN=A123456.SORT.SAMPADD,DISP=SHR

//DAPUBS DD DSN=&&DSRT,DISP=(,PASS),SPACE=(CYL,(2,2)),UNIT=SYSDA

//PRPUBS DD SYSOUT=A

//SPUBCNTL DD *

SORT FIELDS=(106,4,A,1,75,A),FORMAT=CH

INCLUDE COND=(106,4,EQ,C’VALD’,OR,106,4,EQ,C’WETH’),

FORMAT=CH

/*

//CACOCNTL DD *

SORT FIELDS=(1,15,CH,A)

OUTFIL FNAMES=(CADASD,CATAPE),INCLUDE=(16,2,CH,EQ,C’CA’)

OUTFIL FNAMES=(CODASD,COTAPE),INCLUDE=(16,2,CH,EQ,C’CO’)

/*

//CADASD DD DSN=&&CA,DISP=(,PASS),SPACE=(CYL,(2,2)),UNIT=3390

//CATAPE DD DSN=CA.BRANCH,UNIT=3480,VOL=SER=111111,

// DISP=(NEW,KEEP),LABEL=(,SL)

//CODASD DD DSN=&&CO,DISP=(,PASS),SPACE=(CYL,(2,2)),UNIT=3390

//COTAPE DD DSN=CO.BRANCH,UNIT=3480,VOL=SER=222222,

// DISP=(NEW,KEEP),LABEL=(,SL)

//RPT DD SYSOUT=A

//SECTIONS DD SYSOUT=A

//BKIN DD DSN=A123456.SORT.SAMPIN,DISP=SHR

//PUBCT DD SYSOUT=A

//BKOUT DD DSN=A123456.BOOKS1,DISP=(NEW,CATLG,DELETE),

// SPACE=(CYL,(3,3)),UNIT=3390

//REGNIN1 DD DSN=A123456.REGION.IN1,DISP=SHR

//REGNIN2 DD DSN=A123456.REGION.IN2,DISP=SHR

//T1 DD DSN=&&T1,UNIT=3390,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)

//REGNOUT DD DSN=A123456.REGION.OUT,DISP=(NEW,CATLG,DELETE),UNIT=3390,

// SPACE=(TRK,(5,5))

6 DFSORT

//CTL1CNTL DD *

* Move REGION.IN1 fields to their locations for the

* output data set

OUTREC BUILD=(5:1,5, Region

10:21,15, Regional Director

39:6,15) Headquarters

/*

//CTL2CNTL DD *

* Move REGION.IN2 fields to their locations for the

* output data set

OUTREC BUILD=(1:1,4, Office

5:5,5, Region

25:10,4, Employees

29:14,10, Evaluation

53:X)

/*

ICETOOL can be called directly, as in the example above, or from a program using a parameter list to which

ICETOOL can additionally return information for further processing.