This section contains an example of ICETOOL with various operators.
- INPUT
- Multiple data sets
- OUTPUT
- Multiple data sets
- WORK DATA SETS
- Dynamically allocated (automatic)
- USER EXITS
- ICETOOL's E35 (automatic)
- FUNCTIONS/OPTIONS
- OCCUR, COPY, SORT, MODE, VERIFY, STATS, DISPLAY
//EXAMP JOB A400,PROGRAMMER 01
//TOOLRUN EXEC PGM=ICETOOL,REGION=1024K 02
//TOOLMSG DD SYSOUT=A 03
//DFSMSG DD SYSOUT=A 04
//TOOLIN DD * 05
* Print report showing departments with less than 5 employees 06
OCCUR FROM(IN1) LIST(LT5) LOWER(5) BLANK - 07
TITLE('Small Departments') PAGE - 08
HEADER('Department') HEADER('Employees') - 09
ON(45,3,CH) ON(VALCNT) 10
* Sort by last name and first name 11
SORT FROM(IN1) TO(DEPTSD,DEPTSP) USING(ABCD) 12
* Do following operators even if a previous operator failed, 13
* but stop processing if a subsequent operator fails. 14
MODE STOP 15
* Verify decimal fields 16
VERIFY FROM(IN2) ON(22,6,PD) ON(30,3,ZD) 17
* Print statistics for record length and numeric fields 18
STATS FROM(IN2) ON(VLEN) ON(22,6,PD) ON(30,3,ZD) 19
* Sort and produce total for each unique key 20
SORT FROM(IN2) TO(OUT4) USING(CTL1) 21
* Print report containing: 22
* - key and total for each unique key 23
* - lowest and highest of the totals 24
DISPLAY FROM(OUT4) LIST(LIST1) - 25
TITLE('Unique key totals report') DATE TIME - 26
ON(5,10,CH) ON(22,6,PD) ON(30,3,ZD) - 27
MINIMUM('Lowest') MAXIMUM('Highest') PLUS 28
//LT5 DD SYSOUT=A 29
//IN1 DD DSN=FLY.INPUT1,DISP=SHR 30
//ABCDCNTL DD * 31
* Sort by last name, first name 32
SORT FIELDS=(12,15,CH,A,1,10,CH,A) 33
//DEPTSD DD DSN=FLY.OUTPUT1,DISP=SHR 34
//DEPTSP DD SYSOUT=A 35
//IN2 DD DSN=FLY.INPUT2,DISP=SHR 36
//OUT4 DD DSN=FLY.OUTPUT2,DISP=OLD 37
//CTL1CNTL DD * 38
* Sort and produce totals in one record for each unique key 39
SORT FIELDS=(5,10,CH,A) 40
SUM FIELDS=(22,6,PD,30,3,ZD) 41
//LIST1 DD SYSOUT=A 42
This example shows how ICETOOL can be used to perform multiple
operations in a single step.
- Line
- Explanation
- 01
- JOB statement. Introduces this job to the operating system.
- 02
- EXEC statement. Calls ICETOOL specifying the recommended REGION
of 1024K.
- 03
- TOOLMSG DD statement. Directs ICETOOL messages and statements
to system output class A.
- 04
- DFSMSG DD statement. Directs DFSORT messages and control statements
to SYSOUT class A.
- 05
- TOOLIN DD statement. ICETOOL statements follow. The MODE for
the ICETOOL run is initially set to STOP. If an error is detected
for an operator, SCAN mode will be entered.
- 06
- Comment statement. Printed but otherwise ignored.
- 07-10
- OCCUR operator. Prints, in the LT5 data set, a report detailing
each value for the specified field in the IN1 data set and the number
of times that value occurs.
- 11
- Comment statement.
- 12
- SORT operator. Records from the IN1 data set are sorted to the
DEPTSD and DEPTSP data sets using the DFSORT control statements in
the ABCDCNTL data set. As a result, FLY.OUTPUT1 and DEPTSP (SYSOUT)
contain the sorted records from FLY.INPUT1.
- 13-14
- Comment statements.
- 15
- MODE operator. The MODE is reset to STOP (needed in case SCAN
mode was entered due to an error for a previous operator). If an error
is detected for a subsequent operator, SCAN mode will be entered.
This divides the previous operators and subsequent operators into
two unrelated groups.
- 16
- Comment statement.
- 17
- VERIFY operator. Identifies invalid values, if any, in the specified
decimal fields of the IN2 data set. Used to stop subsequent operations
if any invalid value is found in FLY.INPUT2.
- 18
- Comment statement.
- 19
- STATS operator. Prints the minimum, maximum, average, and total
for the specified fields of the IN2 data set.
ON(VLEN) operates
on the record length of the records in FLY.INPUT2. Thus, the values
printed for ON(VLEN) represent the shortest record, the longest record,
the average record length, and the total number of bytes for FLY.INPUT2.
- 20
- Comment statement.
- 21
- SORT operator. Records from the IN2 data set are sorted and
summarized to the OUT4 data set using the DFSORT control statements
in the CTL1CNTL data set. As a result, FLY.OUTPUT2 contains one record
from FLY.INPUT2 for each unique sort field with totals for the sum
fields.
- 22-24
- Comment statements.
- 25-28
- DISPLAY operator. Prints, in the LIST1 data set, a report detailing
each sort and sum value for the OUT4 data set resulting from the previous
operation, and the lowest and highest value for each sum field.
- 29-42
- DD statements. Defines the data sets and DFSORT control statements
used for the ICETOOL operations described previously
in this section.