ICETOOL

ICETOOL is a batch front-end utility that uses the capabilities of DFSORT to
perform the operations you request. Input and output datasets can be defined using user-defined DD names. The file operations are specified in the TOOLIN DD statement. Additional conditions can be specified in user-defined ‘CTL’ DD statements. A few of the utilities of ICETOOL are given below:

  • ICETOOL can achieve all the functionalities of DFSORT in one or more conditions.
  • SPLICE is a powerful operation of ICETOOL which is similar to SORT JOIN, but with additional features. It can compare two or more files on specified field(s) and create one or more output files like file with matching records, file with non-matching records, etc.
  • Data in one file in a particular position can be OVERLAYed into another position in the same or different file.
  • A File can be split into n files based on a specified condition. For example, a file containing names of employees can be split into 26 files, each containing the names starting with A, B, C and so on.
  • Different combination of file manipulation is possible using ICETOOL with a little exploration of the tool.

ICETOOL sets a return code for each operation it performs in STOP or CONTINUE mode and passes back the highest return code it encounters to the operating system or the invoking program.

  • For successful completion of all operations, ICETOOL passes back a return code of 0 or 4 to the operating system or the invoking program.
  • For unsuccessful completion due to an unsupported operating system, ICETOOL passes back a return code of 24 to the operating system or invoking the program.
  • For unsuccessful completion of one or more operations, ICETOOL passes back a return code of 8, 12, 16, or 20 to the operating system or the invoking program

The first ICETOOL COPY operator writes records to temporary data set T1 consisting of the course number and course name fields from SORT.SAMPIN, and an id of ’11’, as shown below.

Sample JCL- ICETOOL

//STEP001  EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//F1IN     DD DSN=XXXXXXX.SORT.SAMPIN,DISP=SHR
//F2IN     DD DSN=XXXXXXX.SORT.SAMPADD,DISP=SHR
//T1       DD DSN=&&&T1,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(CYL,(5,5),RLSE)
//MATCH DD DSN=XXXXXX.MATCH,DISP=(NEW,CATLG,DELETE),
//  SPACE=(CYL,(5,5)),UNIT=3390
//F1ONLY DD DSN=XXXXXX.INONLY,DISP=(NEW,CATLG,DELETE),
//  SPACE=(CYL,(5,5)),UNIT=3390
//F2ONLY DD DSN=XXXXXX.ADDONLY,DISP=(NEW,CATLG,DELETE),
//  SPACE=(CYL,(5,5)),UNIT=3390
//TOOLIN   DD *
Copy needed File1 fields to T1 and add '11' id
COPY FROM(F1IN) TO(T1) USING(MATA)
Copy needed File2 fields to T1 and add '22' id
COPY FROM(F2IN) TO(T1) USING(MATB)
Splice second id character from overlay to base for matching course
numbers.  Use resulting spliced or unspliced id to write records to MATCH,
* F1ONLY or F2ONLY as appropriate.
SPLICE FROM(T1) TO(MATCH) ON(1,5,CH) -
WITH(32,1) KEEPNODUPS USING(MATC)
/*
//MATACNTL DD *
Extract needed File1 fields and add '11' id
OUTREC FIELDS=(1:115,5,     Course number
             6:120,25,    Course name
             31:C'11')     '11' id for File1 records
/*
//MATBCNTL DD *
Extract needed File2 fields and add '22' id
OUTREC FIELDS=(1:115,5,     Course number
             6:120,25,    Course name
            31:C'22')     '22' id for File2 records
/*
//MATCCNTL DD *
A '12' id indicates a match between File1 and File2.
Remove the '12' id and write the records to MATCH.
OUTFIL FNAMES=MATCH,INCLUDE=(31,2,CH,EQ,C'12'),OUTREC=(1,30)
A '11' id indicates a record in File1 only.
Remove the '11' id and write the records to F1ONLY.
OUTFIL FNAMES=F1ONLY,INCLUDE=(31,2,CH,EQ,C'11'),OUTREC=(1,30)
A '22' id indicates a record in File2 only.
Remove the '22' id and write the records to F2ONLY.
OUTFIL FNAMES=F2ONLY,INCLUDE=(31,2,CH,EQ,C'22'),OUTREC=(1,30)
/*
Table 1. T1 data set fields from SORT.SAMPIN
Course Number Course Name ’11’
1   5 6           30 31 32

The second COPY operator writes records at the end (MOD) of temporary data set T1 consisting of the course number and course name fields from SORT.SAMPADD, and an id of ’22’, as shown below.

Table 2. T1 data set fields from SORT.SAMPADD
Course Number Course Name ’22’
1   5 6           30 31 32

The SPLICE operator matches the course numbers (ON field). When a match is found, the second id character is spliced into the base record. Because WITHALL is not specified, only the last record for each match is spliced with the first record for each match. KEEPNODUPS tells DFSORT to keep records that are not spliced. Without KEEPNODUPS, records for course numbers that appear once in one data set, but not in the other data set, would be deleted instead of being written to COURSE.INONLY or COURSE.ADDONLY.

Here’s what happens for all of the possible types of matches and non-matches:

  • For a course number that appears one or more times with id ’11’ and one or more times with id ’22’, the second ‘2’ from the last ’22’ record is spliced into the first ’11’ record to get an id of ’12’. Thus, an id of ’12’ represents a course number that appears in both SORT.SAMPIN and SORT.SAMPADD
  • For a course number that appears only once with id ’11’ (and not with id ’22’) the id of ’11’ is not changed. For a course number that appears more than once with id ’11’ (and not with id ’22’) the second ‘1’ from the last ’11’ record is spliced into the first ’11’ record to get an id of ’11’. Thus, an id of ’11’ represents a course number that only appears in SORTIN.SAMPIN.
  • For a course number that appears only once with an id of ’22’ (and not with an id of ’11’) the id of ’22’ is not changed. For a course number that appears more than once in with an id of ’22’ (and not with an id of ’11’) the second ‘2’ from the last ’22’ record is spliced into the first ’22’ record to get an id of ’22’. Thus, an id of ’22’ represents a course number that only appears in SORTIN.SAMPADD.

The output created for COURSE.MATCH contains the information for course numbers that appear in both SORT.SAMPIN and SORT.SAMPADD is shown below.

Table 3. COURSE.MATCH output
Course Number Course Name
1   5 6           30
 
00103
00205
10054
30016
30975
50420
50521
50632
70124
70251
 
DATA MANAGEMENT
VIDEO GAMES
FICTION WRITING
PSYCHOLOGY I
PSYCHOANALYSIS
WORLD HISTORY
WORLD HISTORY
EUROPEAN HISTORY
ADVANCED MARKETING
MARKETING

The output created for COURSE.INONLY containing the information for course numbers that appear only in SORT.SAMPIN is shown below.

Table 4. COURSE.INONLY output
Course Number Course Name
1   5 6           30
00032
10347
10856
80521
INTRO TO COMPUTERS
TECHNICAL EDITING
MODERN POETRY
BIOLOGY I

The output created for COURSE.ADDONLY containing the information for course numbers that appear only in SORT.SAMPADD is shown below.

Table 5. COURSE.ADDONLY output
Course Number Course Name
1   5 6           30
70255
80522
80523
BUSINESS THEORY
BIOLOGY II
INTRO TO GENETICS

Read JCL blogs : Click Here SYNCSORT Manual : Click Here

Scroll to Top