Operations


ICETOOL uses the DFSORT capabilities to perform multiple operations in a single step on one or more files. Below are the 17 ICETOOL operators used to perform a variety of functions -

Copy data from input to output file(s) (COPY Operator )


COPY operator is used to copy records from input file to one or more output files. For example - Copy all the records from input file to output file.

//STEP01   EXEC PGM=ICETOOL 
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILE, 
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  COPY FROM(INDD) TO(OUTDD)
/*

Displays the records count (COUNT Operator )


COUNT operator displays message with the count of records in a file in the spool. For example - Count the records whose country is 'IN' (from 60th byte of length 2).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//TOOLIN   DD *
  COUNT FROM(INDD) USING(CTL1)
/*
//CTL1CNTL DD *
  INCLUDE COND=(60,2,CH,EQ,C'IN')
/*

Sort records between header and footer (DATASORT Operator )


DATASORT operator sorts data records between header and trailer records in a file and copies all records (includes header and footer) along with sorted records to an output file.

For example - Sort the employee data records (keep the header and footer as it is) based on the country code (from the 60th position of length 2) to the output file.

//STEP01   EXEC PGM=ICETOOL 
//INDD     DD DSN=MATEPK.INPUT.PSFILE1,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILE1,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  DATASORT FROM(INDD) TO(OUTDD) HEADER(2) TRAILER(2) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(60,2,CH,A)
/*

Displays installation defaults (DEFAULTS Operator )


DEFAULTS operator displays the DFSORT installation defaults in a separate list file. For example - Displays the DFSORT installation defaults to the list dataset.

//STEP01   EXEC PGM=ICETOOL
//LISTDD   DD DSN=MATEPK.INPUT.PSFILE2,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=121,BLKSIZE=242)
//TOOLIN   DD *
  DEFAULTS LIST(LISTDD)
/*

Displays aggregate information (DISPLAY Operator )


DISPLAY operator writes the values of numerical fields and can produce maximums, minimums, totals, averages, and counts. For example - Displays the DFSORT installation defaults to the list dataset.

//STEP01   EXEC PGM=ICETOOL
//LISTDD   DD DSN=MATEPK.INPUT.PSFILE2,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=121,BLKSIZE=242)
//TOOLIN   DD *
  DEFAULTS LIST(LISTDD)
/*

Merges multiple input files, processes, and splits into output files (MERGE Operator )


MERGE operator merges one or more input files into one or more output files. For example - Merges the employee details and separates employee details based on the country code "IN", "US" (from the 60th position of length 2).

//STEP01   EXEC PGM=ICETOOL
//INDD01   DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//INDD02   DD DSN=MATEPK.INPUT.PSFILE4,DISP=SHR 
//OUTDD1   DD DSN=MATEPK.OUTPUT.PSFILE3, 
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//OUTDD2   DD DSN=MATEPK.OUTPUT.PSFILE4,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  MERGE FROM(INDD01,INDD02) USING(CTL1)
/*
//CTL1CNTL DD *
  MERGE FIELDS=(1,3,ZD,A)
  OUTFIL FNAMES=OUTDD1,INCLUDE(60,2,CH,EQ,C'IN')
  OUTFIL FNAMES=OUTDD2,INCLUDE(60,2,CH,EQ,C'US')
/*

Error checking and further actions (MODE Operator )


MODE operator uses for error checking and specifies the actions to be performed after error detection. The actions are - STOP, CONTINUE and SCAN. For example - Separate employee details based on "IN", "US". If any error occurs in the first processing stops the second process.

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD1   DD DSN=MATEPK.OUTPUT.PSFILEM1,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//OUTDD2   DD DSN=MATEPK.OUTPUT.PSFILEM2,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD * 
  COPY  FROM(INDD) TO(OUTDD1) USING(CTL1)
  MODE  STOP
  COPY  FROM(INDD) TO(OUTDD2) USING(CTL2)
/*
//CTL1CNTL DD * 
  INCLUDE COND=(60,2,CH,EQ,C'IN') 
/* 
//CTL2CNTL DD *
  INCLUDE COND=(60,2,CH,EQ,C'US')
/*

Displays the value occurrences (OCCUR Operator )


OCCUR operator displays each unique occurrence and how many times they occur for coded numeric/character fields in output list file. For example - Display the number of employees based on the country code(two characters from the 60th column).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILEO,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  OCCUR FROM(INDD) LIST(OUTDD)                  - 
        TITLE('EMPLOYEES COUNT: COUNTRY LEVEL') -
        ON(60,2,CH) ON(VALCNT)
/*

Displays value count between range (RANGE Operator )


RANGE operator displays a message with the count of values that are in between the coded range for a field. For example - Displays the active employees count in between 2 and 6.

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILER,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=49,BLKSIZE=490)
//TOOLIN   DD *
  RESIZE FROM(INDD) TO(OUTDD) TOLEN(49)
/*

Splits or merges records (RESIZE Operator )


RESIZE operator creates a larger record from multiple shorter records and also creates multiple shorter records from a larger record. For example - Resize the employees record length from 80 to 49.

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//TOOLIN   DD *
  RANGE FROM(INDD) ON(1,3,ZD) HIGHER(2) LOWER(6)
/*

Selects specific records from input (SELECT Operator )


SELECT operator selects the specific records from an input file and writes in an output file based on selection criteria. For example - Select the first two records for each different value in the sorting criteria.

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILES,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  SELECT FROM(INDD) TO(OUTDD) ON(60,2,CH) FIRST(2)
/*

Sorts the records (SORT Operator )


SORT operator sorts the records in the input file and copies the records into the output files. It allows up to 10 input files. For example - Sort the employee records based on employee name (15 character length from 6th position).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILEST,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD * 
  SORT   FROM(INDD) TO(OUTDD) USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(6,15,CH,A)
/*

Joins the records using common fields (SPLICE Operator )


SPLICE operator joins the records together from the multiple files based on the coded fields with matching values. For example - Create one spliced record for each match in two files.

//STEP01   EXEC PGM=ICETOOL
//INDD1    DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR 
//INDD2    DD DSN=MATEPK.INPUT.PSFILE3,DISP=SHR 
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),
//            SPACE=(TRK,(5,5)),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILESP,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  COPY FROM(INDD1) TO(TEMP) USING(CTL1)
  COPY FROM(INDD2) TO(TEMP) USING(CTL2)
  SPLICE FROM(TEMP) TO(OUTDD) ON(1,3,ZD) WITH(70,10)
/*
//CTL1CNTL DD *
  OUTREC FIELDS=(1,69,70:X)
/*
//CTL2CNTL DD *
  OUTREC FIELDS=(1:1,3,70:10,10)
/*

Displays statistics of the data (STATS Operator )


STATS operator displays the minimum, maximum, average, and total statistics for specified numeric fields in the input file. For example - Display statistics for numeric field. In the below example, we are display statistics for employee salary field (from 70-79 columns).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE5,DISP=SHR
//TOOLIN   DD *
  STATS  FROM(INDD) ON(70,10,ZD)
/*

Copies subset of the records (SUBSET Operator )


SUBSET operator selects records from a dataset by keeping or removing the header, relative, or trailer records. For example - Copy only data records (exclude header and footer).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE1,DISP=SHR
//OUTDD    DD DSN=MATEPK.OUTPUT.PSFILESS,
//            DISP=(NEW,CATLG,DELETE),VOLUME=SER=DEVHD4,
//            SPACE=(TRK,(1,1),RLSE),UNIT=SYSDA,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//TOOLIN   DD *
  SUBSET FROM(INDD) TO(OUTDD) REMOVE OUTPUT HEADER(2) TRAILER(2)
/*

Displays unique count of field (UNIQUE Operator )


UNIQUE operator displays a message with the unique values count for a specified numeric or character field. For example - Displays the unique values count for country field (2 columns length from 60th column).

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE,DISP=SHR
//TOOLIN   DD *
  UNIQUE FROM(INDD) ON(60,2,CH)
/*

Verify the existance of numeric data (VERIFY Operator )


VERIFY operator is used to verify the existance of numeric data in specified columns of all the records. For example - Verifing the existance of non-numeric values between the 70 to 79 columns.

//STEP01   EXEC PGM=ICETOOL
//INDD     DD DSN=MATEPK.INPUT.PSFILE6,DISP=SHR
//TOOLIN   DD *
  VERIFY FROM(INDD) ON(70,10,ZD)
/*